Obviously installing gcc from source will require a compiler to build it; is it possible to install gcc without Xcode?

  • When you say Xcode without any qualifications I assume you mean the Xcode.app downloadable from the App Store weighing in at +4 GB in size. You can simply install Xcode Command Line Tools (~200 MB) in order to compile many utilities from source code, which is my preference over downloading precompiled binaries from some sources. See How to Install Command Line Tools in OS X Mavericks & Yosemite (Without Xcode) which should work in later versions of OS X as well. In a Terminal run: xcode-select --install – user3439894 Jan 17 '16 at 19:48

You can find several versions of gcc for different OS X flavors here: HPC Mac OS X.

Download my binaries, and cd to the download folder. Then gunzip gcc-5.3-bin.tar.gz (if your browser didn't do so already) and then sudo tar -xvf gcc-5.3-bin.tar -C /. It installs everything in /usr/local. You can invoke the Fortran 95 compiler by simply typing gfortran.

[To compile other sources...] you will also need to have Apple's XCode Tools installed from the Mac App Store. With XCode 4 or better you will need to download the command-line tools as an additional step. You will find the option to download the command-line tools in XCode's Preferences. On 10.9 Mavericks or higher, you can get the command-line tools by simply typing xcode-select --install.

Addition in square brackets by me...

Please also visit Information Security Stack Exchange and search for questions about the security risks associated with precompiled compilers from "unknown" sources.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .