Main Content

Set Run-Time Library Path on Linux Systems

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

The command you use depends on your shell. The command replaces the existing LD_LIBRARY_PATH value. If LD_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 LD_LIBRARY_PATH matlabroot/bin/glnxa64:matlabroot/sys/os/glnxa64

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

Bourne Shell

Set the library path using the following command format.

LD_LIBRARY_PATH=matlabroot/bin/glnxa64:matlabroot/sys/os/glnxa64:LD_LIBRARY_PATH 
export LD_LIBRARY_PATH

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

See Also