How do I configure the LD_LIBRARY_PATH on Linux and DYLD_LIBRARY_PATH on MAC OS X to point to MCR?

409 views (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 29 Jul 2019
To set the LD_LIBRARY_PATH on Linux follow the steps below:
1. Determine Linux shell being used. Use the following command on the Linux terminal:
echo $SHELL
For a TCSH shell this will return "/bin/tcsh"
For a BASH shell this will return "/bin/bash"
2. Check if you have a .tcshrc or .bashrc file ("the startup file") on your system. These files are run whenever a new terminal is opened.
ls -all
3. If the startup file is not present, you can create one for TCSH/BASH respectively:
touch .tcshrc
touch .bashrc
4. Check if LD_LIBRARY_PATH has been set already:
This will either return the value for LD_LIBRARY_PATH or the following message:
LD_LIBRARY_PATH: Undefined variable
5. Open the file for editing in vi for TCSH/BASH respectively:
vi .tcshrc
vi .bashrc
6. Append the paths from the Configuration Notes dialog box ("<mypath>") obtained during MCR installation.
If LD_LIBRARY_PATH was not already set (refer to Step 4), append the variable using the first line. Otherwise, use the second.
export LD_LIBRARY_PATH=<mypath>
setenv LD_LIBRARY_PATH <mypath>
7. Save and exit vi using Shift + :wq
8. Confirm the LD_LIBRARY_PATH has been set correctly. Open a new terminal and execute:
This should now reflect the paths to the MCR that you just set.
To set DYLD_LIBRARY_PATH on MAC OS X 10.11 and newer, you must use the following syntax when running an application (""):
DYLD_LIBRARY_PATH="/my/path/to/mcr" ./
This is because dynamic library environment variables are no longer copied to child processes, due to System Integrity Protection.

More Answers (1)

Giacomo Rebonato
Giacomo Rebonato on 30 Jan 2021
After I set LD_LIBRARY_PATH to include Matlab Runtime I find that SSL connection to services with self signed certificates (all AWS services) is broken.
The SSL connection could not be established, see inner exception.
The remote certificate is invalid according to the validation procedure
Do you know a solution to this problem?


Find more on Startup and Shutdown in Help Center and File Exchange


No tags entered yet.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!