Search code examples
gfortrannetbeans-8

Configuring gfortran compiler on NetBeans 8.2 on MacOS 10.14.3


I'm trying to run fortran code using NetBeans 8.2 on my Mac running MacOS 10.14.3 Mojave. I installed gcc using homebrew, and the compiler is found at /usr/local/Cellar/gcc/8.2.0/bin/gfortran. This is the error from NetBeans Console:

cd '/Users/david/Desktop/Computational/ComputationalHW'
/usr/bin/make -f Makefile CONF=Debug
"/Library/Developer/CommandLineTools/usr/bin/make" -f
nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
"/Library/Developer/CommandLineTools/usr/bin/make"  -f
nbproject/Makefile-Debug.mk dist/Debug/GNU-MacOSX/computationalhw
mkdir -p dist/Debug/GNU-MacOSX
gfortran    -o dist/Debug/GNUMacOSX/computationalhwbuild/Debug/GNUMacOSX/HW1.o 
make[2]: gfortran: No such file or directory
make[2]: *** [dist/Debug/GNU-MacOSX/computationalhw] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 113ms)

Here's my configuration from NetBeans: image

UPDATE: I have also tried this configuration, same error:

/usr/local/bin/gfortran

Any help is appreciated.

UPDATE: One must simply add /usr/local/bin/ to $PATH on NetBeans. This resolves the issue.


Solution

  • Turns out NetBeans does not look under /usr/local/bin even though you might declare your compiler to be directly underneath that directory. Therefore, it is necessary to add the /usr/local/bin option to the $PATH configuration. enter image description here

    On the Build Tools options in the settings on NetBeans, click on the $PATH button across Base Directory and under PATH = add the path to your own directory where your compiler is found.

    Mine looks likes this:

    ${TOOLS_PATH};${PATH};/usr/local/bin
    

    enter image description here