MATLAB Answers

What are symbolic links, and why does the MATLAB installer ask if I want to create them?

588 views (last 30 days)
I would like to know what symbolic links are, and the MATLAB installer asks if I want to create them.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
In the Unix architecture, symbolic links point to another file / script / program, such as a shortcut does in the Windows architecture. The reason the MATLAB installer offers to install them is because the /bin and /usr/bin directories are in the system path, while the MATLAB directory is not.
The /bin and /usr/bin directories contain common system programs, as well as links to other programs, so if you type a command such as 'ifconfig' from anywhere, it will check those directories (and others in the path) first.
This is convenient for starting MATLAB from any directory; if the links are installed, you do not have to change to the MATLAB directory in order to start MATLAB. Keep in mind you need to be running the installer as 'root' to install the symbolic links.
In order to manually create the symbolic link, browse to the /usr/local/bin/ folder and run the following command:
ln -s $MATLAB/bin/matlab matlab
where $MATLAB is the MATLAB installation directory.


Show 3 older comments
Walter Roberson
Walter Roberson on 5 Apr 2018
ls -ld /usr/local/bin/matlab
You will see the destination listed. You can
sudo rm /usr/local/bin/matlab
sudo ln -s Full_path_of_whereever_2017a_lives /usr/local/bin/matlab
Full_path_of_whereever_2017a_lives should the old content you saw listed for /usr/local/bin/matlab except with 2017b replaced by 2017a
Luca Bellino
Luca Bellino on 22 May 2018
Hello, I have the same problem. I would like to run matlab form any drive with my Terminal on Mac, and i follow the instruction going first in MAchintosh HD, then /Applications/, where the matlab executable exist. Then I run the command:
sudo ln -s /Applications/ matlab
but the result is
ls: matlab: File exists
but if i try to run matlab form anywhere it doesn-t work ... how can i do?? Thank you very much
Walter Roberson
Walter Roberson on 22 May 2018
I recommend that you put the following in your ~/.bash_profile
alias matlab="/Applications/ -nojvm -nodesktop"
Once it is there, any new interactive shells for that user will allow you to type
to invoke MATLAB. You might want to play with the flags: when I am using MATLAB from the command window, I am wanting to use it in non-graphics mode, which is why I use the flags I do.

Sign in to comment.

More Answers (1)

Shahbaz Hussain
Shahbaz Hussain on 1 Jul 2020
For whats purpose "alias matlab="/Applications sudo ln -s /Applications/ matlab ls: matlab: File exists alias matlab="/Applications/ -nojvm -nodesktop" -nojvm -nodesktop" these links be used?

  1 Comment

Walter Roberson
Walter Roberson on 1 Jul 2020
Do not combine the alias and the symbolic link. In your ~/.bash_profile put
alias matlab="/Applications/ -nojvm -nodesktop"
After that, exit that terminal session and start a new terminal session. You will then be able to type
at the terminal command prompt, and it will invoke MATLAB R2018a

Sign in to comment.



Community Treasure Hunt

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

Start Hunting!

Translated by