How to install gfortran

less than 1 minute read


Debian-based (Debian, Ubuntu, Mint, etc…)

sudo apt-get gfortran

RPM-based (Red Hat Linux, CentOS, Fedora, openSuse, Mandrake Linux)

sudo yum install gcc-gfortran


  1. Download MinGW from

  2. Run the executable file and follows the steps.

  3. The installation process will prompt the “MinGW Installation Manager”, with a list of packages. Tick mingw32-gcc-gfortran-bin and mingw32-gcc-g++-bin (if you need C/C++ compiler also). If you are prompted with a menu, click on Mark for Install. Then on the top left corner click on Installation > Apply Changes.

  4. After the installation finishes, edit the Enviromental Variables. Search for “Environment Variables” in Windows Search. At the bottom “System Variables” panel, add to the “Path” variable: C:\MinGW\bin or the full address of that folder if you have used a different one during the installation. Click on OK, and OK and close the other windows.

  5. Open a Command Prompt Terminal and try typing gcc –version and press <Enter> to check if it works.


  1. If you don’t have Xcode installed, install it.

  2. Install Command Line Tools for Xcode. Open a terminal window and type:
     xcode-select --install
  3. Install gcc using Homebrew:
     brew update
     brew upgrade
     brew info gcc
     brew install gcc
     brew cleanup



Leave a comment