Improving MATLAB for OS X
MathWorks released an OS X port of MATLAB awhile back but it's pretty rudimentary - it requires XDarwin / OroborOSX, and the install process is just as annoying as the full Unix install. When you get done, you have a directory under /Applications with a few thousand files in a number of different subdirectories and the launcher in bin/launchMATLAB. Ugly and quite contrary to the "thou-shalt-not-clutter-thine-users-Applications-folder" spirit of OS X.
None of this is necessary on OS X because Apple included the NeXT bundle concept, which allows an entire directory structure to be treated as a single file by the user interface. It turns out that there's a rather quick way to produce a more Mac-like MATLAB with a few minutes at a shell prompt:
- Copy the launchMATLAB application from bin to Applications. This is a simple bundle containing a script which will launch the actual matlab binary. We'll use it as the base for our combined MATLAB bundle - I took the opportunity to remove the "launch" prefix since that awkward name was what users saw.
- I used a Terminal session for the remainder of these steps but you should be able to do them in the Finder if you prefer using the "Show Package Contents" context menu item. In either case, everything from this point on happens in the Contents directory inside the application bundle directory.
- Copy the entire MATLAB6p5 directory into Contents
- Replace the existing launch_matlab.sh file with this one:
#!/bin/sh open -a X11 if [ ! "`ps xc | grep quartz-wm`" ]; then sleep 15 if [ ! "`ps xc | grep quartz-wm`" ]; then open -a OroborOSX sleep 60 fi fi cd Contents/MATLAB6p5 bin/mac/setsid bin/matlab -desktop -display :0.0 &
If you have problems, check /var/tmp/console.log. As time allows I'm going to look into creating a special wrapper creation utility which would automate this process but it's a fairly low priority since legal constraints don't prevent me from distributing the completed bundle to my users.


blog comments powered by Disqus