Install Gfortran 8.0 on Linux/Mac/Windows

less than 1 minute read

Gfortran 8.0 Fortran 2018 features includes excellent coarray support.

The caveat to using newer versions of Gfortran is that you may need to also compile other libraries you link with that Fortran compiler, such as HDF5. You can trivially switch between Gfortran compiler versions (or any other program versions) with update-alternatives.

Install

Linux

If you’re having errors getting any version of gfortran installed, try:

apt-add-repository universe

GCC/Gfortran 8 is available from the Ubuntu-test PPA:

  1. add Ubuntu-test PPA
    add-apt-repository ppa:ubuntu-toolchain-r/test
    apt update
    
  2. install the most recent Gfortran (similarly for gcc-8, g++-8)
    apt install gfortran-8
    
  3. Switch between compiler versions with update-alternatives.

A popular alternative is Linuxbrew, which is a fork of Mac homebrew.

Mac

Install the latest gcc, g++ and gfortran on Mac OS via homebrew:

brew install gcc

Windows

Install the latest gcc, g++ and gfortran on Windows

Notes

Ubuntu 16.04/14.04 can only install up to GCC/Gfortran 7 at this time.

Leave a Comment