How to install f77 on Mac OS X 10.6

Joe SHI picture Joe SHI · Mar 29, 2011 · Viewed 19.5k times · Source

Can anyone tell me how to install f77 on Mac OS X 10.6? I am quite new to f77.

Thank you very much

Answer

Jonathan Dursi picture Jonathan Dursi · Mar 29, 2011

So the compiler you're looking for is gfortran, part of the gcc suite. Gfortran will compile old f77 code, but it will also compile more modern (Fortran90, 95, 2003, and some 2008 support) versions of the same language; if you're going to start working on someone's old f77 code I strongly suggest you learn about what more modern versions of fortran look like. Things have improved greatly. You may see options to install g77, which was the previous generation of gnu fortran compilers -- don't do it. It's 5 years old and hasn't been supported for 4 years.

As to installing gfortran, you have several options:

  • MacPorts is one great source for linux software on your mac; it builds things for your machine, so installing can take some time. Once you've installed the macports binaries, you can type "sudo port install gcc46 +gfortran" to install the newest gcc and gfortran compilers.

  • Binaries are available at the HPC for Mac OS X website. I think these are modestly older binaries for 4.5. I haven't tried the gfortran binaries there, but that website is usually reliable.

  • The gcc wiki points still elsewhere for 4.5 binaries for Mac OS X.