A slow running laptop was a good excuse to play around with a fresh install of OSX 10.8 (Mountain Lion). The implementation of Xcode has been changing over the last few versions, so here are the few straight forward steps required to get command-line Fortran running on your Mac.
1. Download Xcode from the App Store
– Run application to Install
– Xcode Preferences -> Downloads -> Command Line Tools
2. GNU Compilers
– Download 10.8 gcc and gfortran binaries and libraries from http://hpc.sourceforge.net.
– In terminal run “sudo tar -xvf gcc-mlion.tar -C /”
– Ensure the line “export PATH=/usr/local/bin:$PATH” is in your .bash_profile.
$ gfortran –version
GNU Fortran (GCC) 4.8.0 20120722 (experimental)
$ gcc –version
gcc (GCC) 4.8.0 20120722 (experimental)
3. Intel Compilers (Fortran Composer 2011)
– Install package.
– For install environment choose “Command line install only”.
– If write permission issues arise, run “sudo chmod u+rwx /Users/Shared/Library/Application\ Support/”.
– source /opt/intel/bin/ifortvars.sh intel64
– source /opt/intel/mkl/bin/intel64/mklvars_intel64.sh
– Run once as “sudo ifort” to overcome some permissions issues with the libraries.
$ ifort –version
ifort (IFORT) 12.1.0 20111011
Example Makefile (FHI-AIMS):
FC = ifort
FFLAGS = -O3 -ip
F90FLAGS = $(FFLAGS)
ARCHITECTURE = Generic
LAPACKBLAS = -L/opt/intel/mkl/lib \
-I/opt/intel/mkl/include -lmkl_intel_lp64 \