MCR with MAC and environment Variable.
9 views (last 30 days)
Show older comments
I hated installing MCR to mac :) . why it can't be as smooth as windows. Here is my problem besides being new to MAC OSX
After I installed MCR I have been asked to set the environment variable. So I assume I just need to open the terminal and copy paste this
setenv DYLD_LIBRARY_PATH
/Applications/MATLAB/MATLAB_Runtime/v90/runtime/maci64:/Applications/MATLAB/MATLAB_Runtime/v90/sys/os/maci64:/Applications/MATLAB/MATLAB_Runtime/v90/bin/maci64
but apparently I have to do this every time I log out. In the following link from Caltech they are mentioning about
" NOTE: To make these changes persistent after logout on UNIX or
Mac machines, modify the .cshrc file to include this setenv
command. "
but I have no idea how to do that. Any help is appreciated
0 Comments
Answers (1)
Walter Roberson
on 14 Jan 2016
The instructions are probably not correct. What you probably need to do is use any convenient editor to create (or edit) your file ~/.bashrc to contain
export DYLD_LIBRARY_PATH=/Applications/MATLAB/MATLAB_Runtime/v90/runtime/maci64:/Applications/MATLAB/MATLAB_Runtime/v90/sys/os/maci64:/Applications/MATLAB/MATLAB_Runtime/v90/bin/maci64
The reference they made to .cshrc was well-meaning but it assumes that people are using a login shell which is csh or a derivative such as tcsh. On OS-X the default for people is bash which is derived from ksh which is derived from sh -- and none of those use .cshrc . (The program sh came first and then after a time someone wrote csh to try to be more user friendly, but csh was broken from a programming point of view so although users might like it, serious programmers tend to avoid it.)
Go into the Terminal app (it is under /Applications/Utilities) . When you get a command line prompt, give the command
echo $SHELL
if you get back a file whose name ends in csh or tcsh then the instructions on that site are relevant for you, but if you get back a file whose name ends in bash or sh or ksh or zsh then .cshrc is not relevant for you (unless they have done something weird)
While you are at the Terminal command window, command
ls ~/.bashrc
If it says that the file does not exist, then in the Terminal window, command
touch ~/.bashrc
to create the file. If the file already exists or you have now created it, then at the terminal window command
open ~/.bashrc
This will open TextEdit . In textedit you can add the line
export DYLD_LIBRARY_PATH=/Applications/MATLAB/MATLAB_Runtime/v90/runtime/maci64:/Applications/MATLAB/MATLAB_Runtime/v90/sys/os/maci64:/Applications/MATLAB/MATLAB_Runtime/v90/bin/maci64
to the end of the file, and then you can use the TextEdit File menu to Save the file.
If your SHELL showed up as csh or tcsh, or in any case if you just want to be more thorough, then you can use the same kind of steps as just above:
ls ~/.cshrc
and if it does not exist, "touch ~/.cshrc", and then once it exists, "open ~/.cshrc", and then in TextEdit, add the line they gave in the instructions,
setenv DYLD_LIBRARY_PATH
/Applications/MATLAB/MATLAB_Runtime/v90/runtime/maci64:/Applications/MATLAB/MATLAB_Runtime/v90/sys/os/maci64:/Applications/MATLAB/MATLAB_Runtime/v90/bin/maci64
and save.
These changes will not affect your current Terminal session but they will affect the next time you start a Terminal session or anything else starts an interactive shell.
2 Comments
Erdem Uguz
on 15 Jan 2016
Edited: Walter Roberson
on 15 Jan 2016
Thank you for very detailed instruction. I have couple of questions due to the fact that my deployed GUI does not work. I install my application and go to launchpad open it. I see the glimpse of the GUI and it shuts itself down. First of all, I know my code is working because I was able to deploy the same code in a windows machine with no problem. Also the code does run with MATLAB in the Mac Computer that I am using. My mac is El Capitan and I saw this post http://www.mathworks.com/matlabcentral/answers/233201-how-to-add-mcr-to-environment-variable-on-mac-osx-el-capitan
with no answer.
in your detailed answer for bashrc
if true
export DYLD_LIBRARY_PATH=
end
but for cshrc
if true
setenv DYLD_LIBRARY_PATH
end
you used export for bashrc and setenv for cshrc
you used = after path for bashrc and non for cshrc
and in the link launchctl setenv DYLD_LIBRARY_PATH
Also while installing MCR it showed
if true
${LD_LIBRARY_PATH}
/Applications/MATLAB/MATLAB_Runtime/v90/runtime/maci64:/Applications/MATLAB/MATLAB_Runtime/v90/sys/os/maci64:/Applications/MATLAB/MATLAB_Runtime/v90/bin/maci64
end
are the differences important I tired almost all combinations but no chance.
See Also
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!