How to install gfortran
Linux
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
Windows
-
Download MinGW from https://sourceforge.net/projects/mingw-w64/.
-
Run the executable file and follows the steps.
-
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.
-
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. -
Open a Command Prompt Terminal and try typing gcc –version and press <Enter> to check if it works.
macOS
-
If you don’t have Xcode installed, install it.
- Install Command Line Tools for Xcode. Open a terminal window and type:
xcode-select --install
- Install gcc using Homebrew:
brew update brew upgrade brew info gcc brew install gcc brew cleanup
Leave a comment