How to install f77 on Mac OS X 10.6

20,248

Solution 1

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.

Solution 2

Intel also provides their compiler to OS X and linux users for free under a very specific non-commercial license. If you are going to be using Fortran in a way that is compliant with their licensing terms you can install it from them. They have a pretty good support forum for their OS X/Linux compiler including install directions.

Share:
20,248
Joe SHI
Author by

Joe SHI

Updated on July 09, 2022

Comments

  • Joe SHI
    Joe SHI almost 2 years

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

    Thank you very much

  • M. S. B.
    M. S. B. about 13 years
    MacPorts "gcc46 +gfortran" didn't install gfortran for me, just gcc, so you might need to fall back to the gcc45 package, which includes gfortran by default. I recommend against the gcc binary at HPC ... it installs (or did several years ago) in /usr/local, which can cause very nasty library conflicts with the OS.
  • deprecated
    deprecated about 13 years
    Err... why should installing something in /usr/local cause any library conflicts with the OS?
  • Calimo
    Calimo almost 11 years
    I had to use gfortran-mp-4.6 as compiler, instead of f77 or gfortran.
  • zbeekman
    zbeekman over 9 years
    The non-commercial license has been removed for Mac OS X and is going away for Linux too. 9/2014
  • Danny F
    Danny F over 2 years
    gfortran will certainly compile f77 code, but it spits out tons of errors - obviously legacy code doesn't do well with new compilers.