7

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

Thank you very much

Joe SHI
  • 1,734
  • 4
  • 20
  • 39
  • 1
    This is probably a question better suited for Super User or Apple... – Jonathan Dursi Mar 29 '11 at 10:47
  • 1
    @Jonathan Dursi - No, it is perfectly fine here. Compiles usually go under "software tools commonly used by programmers" or "matters that are unique to the programming profession". – Rook Mar 29 '11 at 12:42

2 Answers2

11

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.

Jonathan Dursi
  • 50,107
  • 9
  • 127
  • 158
  • 2
    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. – M. S. B. Mar 29 '11 at 14:07
  • 1
    Err... why should installing something in /usr/local cause any library conflicts with the OS? – deprecated Mar 30 '11 at 01:23
  • I had to use gfortran-mp-4.6 as compiler, instead of f77 or gfortran. – Calimo Jun 07 '13 at 13:05
  • gfortran will certainly compile f77 code, but it spits out tons of errors - obviously legacy code doesn't do well with new compilers. – Danny F Sep 12 '21 at 08:35
4

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.

zbeekman
  • 648
  • 7
  • 15