When you build applications, associated shell scripts (run_
)
are automatically generated in the same folder as your binary. By
running these scripts, you can conveniently set the path to your MATLAB® Runtime location.application
.sh
If the setenv
command fails with a message
similar to setenv: command not found
or setenv:
not found
, you are not using a C Shell command interpreter
(such as csh
or tcsh
).
Set the environment variables using the export
command
using the format export
. my_variable
=my_value
For example, to set DYLD_LIBRARY_PATH
, run
the following command:
export DYLD_LIBRARY_PATH=mcr_root/v99/runtime/maci64:mcr_root/ ...
If you set your environment variables, you may still receive the following message when you run your application:
dyld: Library not loaded: @rpath/libmwlaunchermain.dylib Referenced from: /Applications/magicsquare/application/ magicsquare.app/Contents/MacOS/magicsquare Reason: image not found Trace/BPT trap: 5
You may have set your environment variables initially, but they were not set up as persistent variables. Do the following:
In your home directory, open a file such as .bashrc
or .profile
file
in your log-in shell.
In either of these types of log-in shell files, add
commands to set your environment variables so that they persist. For
example, to set DYLD_LIBRARY_PATH
in this manner,
you enter the following in your file:
# Setting PATH for MCR DYLD_LIBRARY_PATH=MCR_ROOT/v99/runtime/maci64: MCR_ROOT/v99/sys/os/maci64: MCR_ROOT/v99/bin/maci64 export DYLD_LIBRARY_PATH ?
Note
The DYLD_LIBRARY_PATH=
statement is one statement
that must be entered as a single line. The statement is shown on different
lines, in this example, for readability only.