OS X 10.9 gcc links to clang

GccG++Osx Mavericks

Gcc Problem Overview


I just noticed that after installing OS X 10.9, the g++ compiler links to the clang compiler. Is there anyway to revert back to gcc/g++?

Gcc Solutions


Solution 1 - Gcc

It has been this way for a long time already. The "GCC" that came with 10.8 was really GCC front-end with LLVM back-end.

The best way to get GCC is via Homebrew. After the one-line homebrew install command on the bottom of the linked page, you just need:

$ brew install gcc49

Unlike macports, Homebrew doesn't clutter your system dirs and it's much better at managing versions and uninstalls. It also doesn't require the crutch known as sudo.

Solution 2 - Gcc

You'd have to install it from macports:

$ sudo port install gcc49

However I am not certain how you'd integrate gcc into Xcode 5, however you don't mention why you cannot use clang?

Solution 3 - Gcc

Accessible and up to date GCC packages are at http://hpc.sourceforge.net/

Solution 4 - Gcc

you can also get a g++ compiler from http://hpc.sourceforge.net/. They have the compiler in a pre-built package. Just download and follow their directions. Note you may need to change your executable PATH and have /usr/local/bin ahead of /usr/bin. This is to insure g++ calls the right compiler.

Solution 5 - Gcc

This is by design, and not new in OS X 10.9. Apple deprecated GCC a long time ago. Just use Clang, or if you need fortran/openmp/..., install GCC yourself through homebrew/macports/...

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionryanView Question on Stackoverflow
Solution 1 - GccAdamView Answer on Stackoverflow
Solution 2 - GcctrojanfoeView Answer on Stackoverflow
Solution 3 - Gccuser2962717View Answer on Stackoverflow
Solution 4 - GccZachary KrausView Answer on Stackoverflow
Solution 5 - GccrubenvbView Answer on Stackoverflow