problems calling matlab from command line in OS X

2 views (last 30 days)
Hi. I installed Matlab 2011a before removing 2009a. After the installation '$which matlab' pointed to /usr/bin/matlab, which called 2009a.
Now I've removed 2009a (just deleted it from Applications) and '$which matlab' is blank.
'$ls /usr/bin/matlab' shows a file, but Finder doesn't see it when I navigate to /usr/bin/.
How do I get '$matlab' to call 2011a?
  1 Comment
Robert
Robert on 22 Aug 2011
Thanks Kelly and Daniel. ls -l showed that /usr/bin/matlab pointed to the deleted 2009a version.
Daniel's advice worked. Here are the exact commands I used, in case someone else has this problem:
$ sudo rm /usr/bin/matlab
$ sudo ln -s /Applications/MATLAB_R2011a.app/bin/matlab /usr/bin/matlab
Of course, you'll likely have to modify the path(s) above.

Sign in to comment.

Accepted Answer

Daniel Shub
Daniel Shub on 22 Aug 2011
I am a Linux user and sometimes there are odd differences between Linux and Mac, but you should be able to just recreate the symbolic link. From the command line as a privileged user you would want to do something like:
ln -s /usr/local/matlab/r2011a/bin/matlab /usr/bin/matlab
with /usr/local/matlab/r2011a/bin/matlab tailored to be your install directory.

More Answers (1)

Kelly Kearney
Kelly Kearney on 22 Aug 2011
The /usr/bin/matlab file should be a symbolic link; do an ls -l to see where it's pointing (should point to <matlabroot >/bin/matlab). In my experience this link always updates to the most recently installed version of Matlab (I never uninstall my previous versions), though it would seem something went wrong on your most recent install.
Can't recall whether Finder shows symbolic links by default or not... they show up in mine, but I may have altered preferences for this.
You might want to try reinstalling the new version of Matlab, and see if the link resurrects itself. Not sure if manually creating it (via ln) would do more harm than good.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!