1

I need to use/integrate GCC 5.X (in my case 5.3, and it is already installed) on Xcode 6.2.

I've found a lot of outdated tutorials about GCC 4.X and Xcode 5 (or lower), but all of them are outdated and do not work anymore.

I've also found this tutorial, but I have not the 5.3.xcplugin file that the tuto recommend to copy.

I am still on Mac OS X Maverick, and I can install Xcode 7 if necessary.

Anybody would know how to do it?

FiReTiTi
  • 5,597
  • 12
  • 30
  • 58

1 Answers1

2

MacPorts still has an installer for Mavericks. It will likely add /opt/local/bin:/opt/local/sbin to your $PATH in .profile, or whatever shell startup file you use, and leave a backup of the old file you can probably get rid of once you're satisfied.

I would suggest upgrading to the latest Xcode release - and to El Capitan unless you have some specific reason not to. AFAIK, if you can run Mavericks, you can run the latter. I will avoid any arguments about the merits of Brew vs. MacPorts here. There's plenty of documentation on the MacPorts pages.

Make sure the package database is up to date:

sudo port -v selfupdate`

Have a look at the existing gcc ports:

port list | grep gcc

note: you might as well install the stable gcc6 (6.1.0) package. Install the package - this may also install dependency packages:

sudo port install gcc6 [-universal]

This may take a while, as it might need to build from source. For most packages, the -universal flag says that you don't care about 32-bit (IA32) builds, etc.

You can see various package versions with port select ... options, e.g.,

port select --list gcc

And enable the installed gcc:

sudo port select --set gcc mp-gcc6

You may need to rehash so the shell adds the new binaries to its search. Or just start a new shell. gcc -v should yield something like:

gcc version 6.1.0 (MacPorts gcc6 6.1.0_0)

Brett Hale
  • 21,653
  • 2
  • 61
  • 90
  • Thank you for your answer. I was probably not clear in my question title (my bad), but GCC 5.3 is already installed, but not recognized/accessible/used by Xcode. So I want to know how I can tell Xcode to use GCC instead of clang. – FiReTiTi May 15 '16 at 07:43
  • @FiReTiTi - yeah, I actually wondered if I'd answered the wrong issue when I looked back over it. I can only suggest searches for gcc / Xcode integration, or perhaps even asking on [apple](http://apple.stackexchange.com/). – Brett Hale May 15 '16 at 07:46
  • I've read most of the links provided by googling "gcc / Xcode integration". Thanks for the link to the other forum. – FiReTiTi May 15 '16 at 08:01