This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Problems Setting MATLAB Runtime Paths

When you build applications, associated shell scripts ( 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/v96/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:

dyld: Library not loaded: @rpath/libmwlaunchermain.dylib 
Referenced from: /Applications/magicsquare/application/ 
  Reason: image not found 
Trace/BPT trap: 5

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


    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.