Getting Matlab v 7.04 to run on OS X Leopard.

Matlab is a super tool for making mathematical and physical models and simulations. I have access to Matlab trough my university, and if you're working with mathematics and physics you should really consider buying this great tool. Visit for more information.

Now to the real contents of this article. If you have purchased a copy of the Mac OS X leopard developer preview, you might have noted that Matlab v. 7.04 dosen't run under OS X Leopard. Well... at least not on the developer preview release. I first tried to google the problem but without sucess. Then I decided to investigate the problem and fix it myself.

Here's what's the problem looks like. First I tried to start matlab from the X11 terminal to be able to see the error message:

sh-3.1# cd ../..
sh-3.1# cd Applications/MATLAB704/BIN/mac
sh-3.1# ./matlab -nojvm
dyld: Library not loaded: /usr/lib/libncurses.5.dylib
Referenced from: ../../bin/mac/libmwbridge.dylib
Reason: image not found
Trace/BPT trap

Ok. So the problem seems to be that the file /usr/lib/libncurses.5.dylib could not be found. This is because the OS X leopard has a newer version of this library, nemly libncurses.5.4.dylib.

A way to fix this could be to look closer at the matlab startup routine and backtrace the error. This would be the pretty way to solve the problem. The fast and ugly way to fix the problem is to just copy the libncurses.5.4.dylib file into a new file called libncursrs.5.dylib from the X11 shell.

First we need to gain root access to your mac to be able to write in the /usr/lib folder. (the user account "root" is the supreme administrator account on UNIX/LINUX based systems) If you haven't allready done this, the procedure is as follows:

Start up the X11 terminal console from within Applications/utilities.

Type the following command:

bash-3.1$ sudo passwd root

Now specify your "normal" password that you use with your user account. (Your default OS X user has administrator privileges, and gives you permission to set the root password)

Then your're able to specify a new password. It sould look like this:

Changing password for root.
New password:
Retype new password:

Now you can gain root acceess to your system. Only log in as root when it's really neccecasy. You can really screw stuff up when you're "the root".

Finally we can start fixing Matlab. From within the shell type the following:

Start by typing su to change the user to root. Then specify the root password:

bash-3.1$ su

Now change the path to /usr/lib:

sh-3.1# cd ../../../..
sh-3.1# cd usr/lib

Now copy libncurses.5.4.dylib to libncurses.5.dylib:

sh-3.1# cp libncurses.5.4.dylib libncurses.5.dylib

That should be all. To test that we no longer get the error message, try to change the path to where Matlab is installed:

sh-3.1# cd ../..
sh-3.1# cd Applications/MATLAB704/BIN/mac

Try to start matlab. This is done by typing "./matlab -nojvm":

sh-3.1# ./matlab -nojvm
dyld: Library not loaded: /usr/local/lib/libXm.2.dylib
Referenced from: ../../bin/mac/libmwhg.dylib
Reason: image not found
Trace/BPT trap

Note that we get another error message than before. This is good. The error message comes because we try to launch Matlab from within the X11 terminal. Try to start matlab by clicking on the matlab icon in the matlab installation folder. Now matlab should start without problems.

Nov, 2006. Written by David