Main Content

Set Run-Time Library Path on macOS Systems

At run time, tell the operating system where the API shared libraries reside by setting the environment variable DYLD_LIBRARY_PATH. Set the value to matlabroot/bin/maci64:matlabroot/sys/os/maci64.

The command you use depends on your shell. The command replaces the existing DYLD_LIBRARY_PATH value. If DYLD_LIBRARY_PATH is already defined, prepend the new value to the existing value.

If you have multiple versions of MATLAB® installed on your system, the version you use to build your engine applications must be the first listed in your system Path environment variable. Otherwise, MATLAB displays Can't start MATLAB engine.

Set the path every time you run MATLAB. Alternatively, place the commands in a MATLAB startup script.

C Shell

Set the library path using the following command format.

setenv DYLD_LIBRARY_PATH matlabroot/bin/maci64:matlabroot/sys/os/maci64

For example, for MATLAB R2015a on a Mac system:

setenv DYLD_LIBRARY_PATH /Applications/MATLAB_R2015a.app/bin/maci64:/Applications/MATLAB_R2015a.app/sys/os/maci64

You can place these commands in a startup script, such as ~/.cshrc.

Bourne Shell

Set the library path using the following command format.

DYLD_LIBRARY_PATH=matlabroot/bin/maci64:matlabroot/sys/os/maci64:$DYLD_LIBRARY_PATH 
export DYLD_LIBRARY_PATH

For example, for MATLAB R2015a on a Mac system:

DYLD_LIBRARY_PATH=/Applications/MATLAB_R2015a.app/bin/maci64:/Applications/MATLAB_R2015a.app/sys/os/maci64:$DYLD_LIBRARY_PATH
export DYLD_LIBRARY_PATH

You can place these commands in a startup script such as ~/.profile.

See Also

External Websites