Matlab Utilities for Mac OS X

Matlab Language Module for BBEdit and TextWrangler

Matlab Language Module is a language module plug-in for BBEdit 11 or 12 and TextWrangler. It provides basic syntax-higlighting and function menu instructions to BBEdit/Textwrangler. Version 2.4 and higher support folding of functions, but version 2.3 does not.


Download Matlab Language Module for BBEdit 11, BBEdit 12 and TextWrangler 5 (Version 2.5)
Download Matlab Language Module for older versions of BBEdit and TextWrangler (Version 2.3)


Unarchive the module using the Finder. The module plug-in is called "Matlab.bblm". Quit BBEdit or TextWrangler if it is open, and place the module in "Applicaton Support/BBEdit/Language Modules" or "Applicaton Support/TextWrangler/Language Modules" folder under your Library folder. (If the folder "Language Modules" does not exist in these locations, simply create a folder of that name there.) You may need to remove the .m suffix mapping for Objective-C in the BBEdit Preferences under Languages to get the Matlab module to work properly. (See the Notes below.)

Source Code

If you want the source code, email me at


2017-10-13: Version 2.5 of the plugin seems to work fine with BBEdit 12. BBEdit 12 now automatically does highlighting of numerical literals. This is not a feature of the plugin.

2016-05-20: The plugin has been updated to version 2.5. This is a compatibility update for upcoming versions of BBEdit 11.6 and higher. Tested with pre-release version 11.6_3921. Version 2.4 will not work properly with 11.6 due to changes in BBEdit's internal representation of text.

2015-10-15: Version 2.4 of the plugin works with TextWrangler 5. Older versions of the plugin do not.

2014-11-15: Version 2.4 of the plugin works with BBEdit 11. Older versions of the plugin do not work with BBEdit 11. Version 2.4 will not work with older versions of BBEdit nor with TextWrangler. Version 2.4 adds some language specific color settings in the BBEdit Text Colors preference panel. This version also adds support for code folding of entire functions. Default line and block comment characters are now set by the plugin so you won't have to set them manually.

2012-08-24: On Mountain Lion compatibility from Tom Shannon at Rush University:

Under Mountain Lion (the new OS version) executable files won't run unless they are authored by a developer with an Apple Development ID. The code has to be signed or, under the default settings, the OS kicks it out and won't let it run. So BBEdit recognizes the plugin but can't load your executable file.

The quick fix for users is to go to the "Matlab" executable in the Matlab.bblm package (Matlab.bblm/Contents/MacOS/Matlab), right click on it and choose open, then tell the OS that its OK to run the executable. Note that you must right click. Double clicking does not work. After that, it will run fine with no intervention.
Thanks Tom

2012-03-06: A number of people have contacted me asking if the plugin still works in BBEdit 10. I have tried it and it does work for me. Things to check:

2008-08-01: UPDATE Version 2.3: I've added keywords: parfor, classdef, properties, events, methods.

2006-06-25: I've changed the archive format from sitx to zip for the above links. If you would rather use Stuffit Expander, you can get the version 2.2 as sitx here.

2006-02-11: I was able to test the universal binary version of the language module on an Intel-based iMac with Text Wrangler and it works fine.

2006-02-08: UPDATE The above link is updated to Version 2.2 of the Language module. I was informed that Matlab 7 supports block comments using the delmiters '%{' and '%}'. Version 2.2 of the language module supports the block comments, and they are colored the same as line comments. The delmiters must appear on lines containing the delimiter and nothing else but whitespace. Block comments may nest. For example:

%{ block commented text %}

is a valid matlab block comment. Also

%{ %{ commented text blah blah blah %} %code to be ignored b = a * x; %}

is a valid nested block comment. If any other characters appear on the lines containing the delmiters, the delimiters turn into ordinary line comment markers. Version 2.2 is a universal binary. Keep in mind that using block comments will make your code incompatible with older versions of Matlab. Block comments are not very necessary anyway since most text editors, including BBEdit/TextWrangler, can easily apply and remove line comments to ranges of text.

2006-01-13: UPDATE The above link now points to Version 2.1 of the Language module. The only change is that the plugin has now been built as a universal binary. I have not tested it on an Intel based Mac. Send me an email if you have any problems with it.

2005-09-12: UPDATE The above link now points to Version 2.0 of the Language module. This new version is a bundle built with Xcode and requires BBEdit 8.0 and higher or TextWrangler 2.0 and higher. You can get the previous version (1.0.2) of the plug-in here.

New in version 2.0:

2005-06-22: BBEdit 8.2.2 has fixed the syntax coloring for compiled language modules. The matlab module should work normally now.

2005-05-11: BBEdit 8.2.1 appears to have broken the syntax coloring in the matlab module. The function popup appears to be unaffected, and built in languages also appear to work normally. I have contacted BareBones and they are aware of the problem. The bug affects compiled language modules. I assume this will be fixed in the next update to BBEdit.

2004-08-30: The Matlab module should work with BBEdit 8.0. Users should be aware that language modules are now installed in BBEdit's ApplicationSupport folder located in the user's Library folder or in the global /Library folder. For example:
/Users/<your user name>/Library/ApplicationSupport/BBEdit/LanguageModules/
is where language modules should be installed.
Also there is new support for what Barebones calls "Codeless Language Modules" presumably for providing a simple way to add new languages using plist files. One could create a matlab module using plists, but there is not much flexibility for handling function definitions nor can the plist distinguish between string delimiters and the matlab transpose operator.

2004-03-29: UPDATE: Matlab Language Module versions 1.0.1 and 1.0.0 don't support Unicode and will not work with BBEdit 7.1.3 or higher. The above link has been updated to 1.0.2 which supports Unicode and will work in the new version of BBEdit. Sorry for any inconvenience.

2002-11-12: I've updated the matlab language module at the above link to version 1.0.1. This version fixes a small bug that caused incorrect syntax coloring of the transpose operator when following a decimal point. If you find any bugs in the module feel free to send me an email about it.

Old Stuff

CMD_Matlab is an applescript that launches Matlab 6.5 for Mac OS X command line mode. This is useful for Jaguar users since the Jaguar release of Mac OS X broke the graphical interface to Matlab 6.5. CMD_Matlab first starts the OroborOSX window manager and then launches matlab in the Terminal. This only works on Mac OS X 10.2. Source is included incase you need to change reference to OroborOSX.

Note: A Matlab patch was released back in mid October 2002 that fixes problems with Jaguar. Go to Mathworks for the updater.

2003-01-10: Mathworks has released a replacement script to make LaunchMATLAB work with Apple's X11. See for details. (1/13/03 Mathworks appears to have removed this page) You'll need to make it executable and open the package contents of LaunchMATLAB and copy it there. Be sure to make a backup of the old script. Here's a stuffed copy of LaunchMATLAB with the replacement script in it. You'll need to put this in the bin folder in your Matlab installation folder for it to work.

2004-03-05: If you use Mac OS X 10.3 (Panther) or higher, you need to run Matlab 6.5.1 with Apple X11 1.0. The LaunchMATLAB app that comes with the 6.5.1 update from Mathworks launches X11 and not OroborOSX. I have not tested any of the above downloads with Panther.

[A. J. Miller] [ESM] [Grad Students] [PSU Engineering] [Penn State]

© Copyright 2002-2017 by Andrew J. Miller. All rights reserved.