How do I install GCC 4.7.2 on OS X 10.8?
Solution 1
MacPorts
The easiest way is to use MacPorts which provides
gcc47 @4.7.2 (lang) The GNU compiler collection
Install MacPorts and then
sudo port install gcc47
This will install several binaries with the -mp-4.7
(as gcc-mp-4.7
). You can then activate gcc 4.7 as default with
sudo port select gcc mp-gcc47
hash gcc
To go back to the Apple LLVM compiler
sudo port select gcc none
hash gcc
Manual installation
Otherwise you can download the tarball from gnu.org and follow the instructions in the INSTALL
file (usually ./configure; make; make install
) but you will have to install all the dependencies by yourself.
A manual installation will (if not specified differently with configure
) install the binaries in /usr/local/bin
.
Solution 2
Download a signed Installer package here: https://www.litebeam.net/macosx/macosx/gcc.html
Related videos on Youtube
MarcusJ
Updated on September 18, 2022Comments
-
MarcusJ over 1 year
How do I install GCC 4.7.2 on OS X 10.8?
I don't care about keeping the Xcode version of "GCC", I just need GCC 4.7.2
-
David Schwartz over 11 yearsDownload gcc 4.7.2. Build it according the instructions. Install it according to the instructions.
-
-
MarcusJ over 11 yearsOkay, I've done that, Homebrew is still saying that I'm using the Apple compiler, how can I change that within Homebrew, or just even regular Terminal?
-
Matteo over 11 yearsOk by that you mean MacPorts or the manual installation?
-
Matteo over 11 years@MarcusJ I updated the answer with some post-installation instructions
-
MarcusJ over 11 yearsI used the Macports method, thanks for the added instruction, I'll try it out in a few hours when I get home.
-
MarcusJ over 11 yearsThanks for that command to select the proper GCC version, it appears that that is only MacPorts wide though?