Documentation

Setting Run-Time Library Path on Mac and Linux Systems

At run time, tell the operating system where the API shared libraries reside by setting an environment variable. Set the path every time you run MATLAB®. Alternatively, place the commands in a MATLAB startup script.

The shell command you use and the value you provide to set the run-time library path depend on your shell and system architecture. The following table lists the name of the environment variable, envvar, and the values, pathspec, to assign to it.

Operating Systemenvvarpathspec

64-bit Apple Mac

DYLD_LIBRARY_PATH

matlabroot/bin/maci64: matlabroot/sys/os/maci64

64-bit Linux®

LD_LIBRARY_PATH

matlabroot/bin/glnxa64: matlabroot/sys/os/glnxa64

These commands replace the existing value in envvar.

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.

C Shell

Set the library path using the command, replacing the terms envvar and pathspec with the appropriate values from the table.

setenv envvar pathspec

For example, on a Mac system:

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

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

Bourne Shell

Set the library path using the command, replacing the terms envvar and pathspec with the appropriate values from the table.

envvar = pathspec:envvar export envvar

For example, on a Mac system:

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

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

Was this topic helpful?