Problems Setting MATLAB Runtime Paths

When you build applications, associated shell scripts (run_application.sh) 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.

Running SETENV on Mac Failed

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/v711/runtime/maci64:mcr_root/ ... 

Mac Application Fails with "Library not loaded" or "Image not found"

If you set your environment variables, you may still receive the following message when you run your application:

imac-joe-user:~ joeuser$ /Users/joeuser/Documents/MATLAB/Dip/Dip ; exit;
dyld: Library not loaded: @loader_path/libmwmclmcrrt.7.11.dylib 
Referenced from: /Users/joeuser/Documents/MATLAB/Dip/Dip 
Reason: image not found 
Trace/BPT trap 
logout

You may have set your environment variables initially, but they were not set up as persistent variables. Do the following:

  1. In your home directory, open a file such as .bashrc or .profile file in your log-in shell.

  2. 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=/Users/joeuser/Desktop/mcr/v711/runtime/maci64:
    /Users/joeuser/Desktop/mcr/v711/sys/os/maci64:/Users/joeuser/Desktop/
    mcr//v711/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.

Was this topic helpful?