Gcc is part of Xcode. You can download it from the App Store. Once it is installed and you start it, it will ask you to install command line tools. Once it is installed, you can open a terminal window and check if it has been installed:
which gcc
It should show: /usr/bin/gcc
Fortran is not available with Xcode... you have a few options:
1. Download the binaries from gcc.gnu.org:
Binaries available for gfortran
MacOS
The gfortran maintainers offer nice Apple-style installers for:
macOS Sierra (10.12): download gfortran 6.3
OS X El Capitan (10.11): download gfortran 6.1
OS X Yosemite (10.10): download gfortran 5.2 or gfortran 4.9.2
OS X Mavericks (10.9): download gfortran 4.9.0 or gfortran 4.8.2
OS X Mountain Lion (10.8): download gfortran 4.8.2
OS X Lion (10.7): download gfortran 4.8.2
2. You can also install from other project packing software like macports or homebrew :
same webpage from above:
Other projects packaging GCC (and gfortran) binaries for Mac include:
- HPC Mac OS X offers GCC builds, which include gfortran
- MacPorts (package name, e.g., "gcc48") - the fastest way to get a developer version of GCC. MacPorts comes with a packing software, but all software is compiled before installation. For the developer version, the "Portfile" is updated approx. weekly.
- Fink offers GCC packages (all released versions) - similar to MacPorts, but also offers binaries; it does not have the developer versions, just the releases.
- via Homebrew
3. Intel Fortran:
Free for students: Free Intel® Software Development Tools
For research: Intel Parallel Studio XE Composer Edition
At this time: 1 floating license : $949