Main Content

Build and Run Fortran Engine Applications on macOS

This example shows how to build and run the example fengdemo.F from the macOS Terminal Window.

Make note of the value of matlabroot, the folder where MATLAB® is installed.


Make note of the value of matlabroot (the folder where MATLAB is installed) command. You will use the value later to set the run-time library path in setenv commands.


Verify your current folder is writable and copy the example.


Build the application.

mex -v -client engine fengdemo.F

Set the run-time library path. This command replaces the value, if any, in DYLD_LIBRARY_PATH. For more information, see Set Run-Time Library Path on macOS Systems.

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

Set the path. Make sure that you include the : path terminator character.

setenv PATH matlabroot/bin:$PATH

Run the example. The fengdemo application must be on your system path.


MATLAB starts and displays a figure.

Type 1 <Enter> at the system prompt to continue and exit.

Related Examples

More About