The Fortran compiler can be installed can be installed as part of the MACPORTS GCC compiler install / build. MACPORTS installs apps in 'HD/opt/local/bin/', in this case 'gfortran' is installed as 'gfortran-mp-6' (or '-mp-5' depending on version). So you have to call 'gfortran-mp-6' in 'Terminal' or script.

gfortran 8.2 for Mojave from 'github' installs in 'HD/usr/local/bin' - check with 'which gfortran' or 'which gfortran-mp-6' on command line.


The Eclipse IDE that covers Fortran has a macOS install. We used the "Eclipse IDE for Scientific Computing " package available here Eclipse . Eclipse packages appear to come as separate apps that install as separate folders with in an overall 'eclipse' folder - in this case this package installs as 'parallel-2018-12'.

However as it calls the gfortran compiler to create the final build of the application, it requires some extra steps to 'find' gfortran, it does not appear to find the file from the normal 'PATH' assigned when the user logs into macOS.

Note that the PATH environment variable the Eclipse uses can be different to the PATH set in your .profile !!

There are two ways to start the Eclipse app so it finds 'gfortran':

1. A script that starts Eclipse from the command line, after specifically adding a 'gfortran' location to '$PATH' before starting the app (after existing $PATH in this case), and allowing the Terminal window to then close without terminating Eclipse. Example below:


# We have left the hash exclamation mark in so that the script can be
# executed from the command line if required.
# The script file is shown as executable by naming the file extension '.command'
# To make the file executable the file flag for execution must be set.
# This can be done on a terminal command line using the command
# 'chmod +x filename.command' to set the executable flag in the file properties.

echo "Start Eclipse with Fortran"

nohup $HOME/eclipse/parallel-2018-12/ -data $HOME/eclipse-workspace

2. Modify the environment for the specific application. This involves editing the application Info.plist and adding an 'LSEnvironment' key. See the Photran 9.1 install guide here for more information.

For macOS 10.4.3 it is required to edit the Info.plist file for the Eclipse executable, and then re-register the Eclipse application with the Launch Service database.

a. In Finder, locate the Eclipse application and Right-click on it to 'Show Package Contents'.

b. Open the Contents folder.

c. Right-click on Info.plist, select Open With, and select Other. Choose TextEdit or say BBEdit, and click OK to open the file in the app.

d. Add an LSEnvironment dictionary below the <dict> line and above the <key>CFBundleExecutable</key> line. An example is shown below.

Be sure to change the path appropriately for your system- in this case we add


to the existing PATH. Save the file and exit the editor when done.

Finally we have to reregister the Eclipse app with Launch Services so it starts with correct paths. In Terminal type the following lines - with the 'eclipse' path as it applies to your system. Here it is in the User/Eclipse folder.

  Example screen shot of Kepler Orbits code running in Fortran. This is a macOS command line program.