I am on Yosemite and trying to compile a software package using g++. Compiling this particular package has previously worked on Mountain Lion under Xcode 4.6.3, but now I have Xcode 6.1.1, and the software won't compile. For this reason, I'd like to be able to switch between different versions of Xcode. I should say I am working exclusively with the command-line tools (CLT), make, g++ and the like. Now I installed an earlier version of Xcode, 4.6.3, so that the situation is the following:

  • /Applications/Xcode.app: current version of Xcode, 6.1.1
  • /Applications/Xcode4.6.3/Xcode.app: earlier version of Xcode, 4.6.3

I was planning on switching in between these two using sudo xcode-select -s PATH. As far as I can tell, this command works, and I can check the result using sudo xcode-select -p. Further, I have CLTs installed in /usr/bin, so that e.g., which g++ shows /usr/bin/g++. Still, if I switch to the older Xcode version, the package won't compile. Interestingly, find below the output of g++ -v for the two different versions of Xcode:

For Xcode 6.1.1:

g++ -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.1.0
Thread model: posix

For Xcode 4.6.3:

g++ -v
couldn't understand kern.osversion `14.1.0'
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

So my questions are:

What does the message couldn't understand kern.osversion 14.1.0 refer to? Is this something I should be worried about?

Why does it continue to show


in the output of g++ -v after selecting the older version, pointing to the new Xcode package, even though I changed the Xcode path using sudo xcode-select -s PATH?

What is your preferred way of having multiple versions of Xcode, each with their own set of CLTs, installed at the same time?

It'd be great if someone could clear things up.

  • If you really need gcc I would install an uptodate version via a package manager e.g. macports, homebrew, or use clang - the Xcode gcc is very old if it exists which it does not in latest Xcode
    – mmmmmm
    Commented Feb 14, 2015 at 17:01
  • What are the errors - possibly clamng has improved to find real errors
    – mmmmmm
    Commented Sep 1, 2018 at 13:07

1 Answer 1


You are on to the best way to manage things.

Have your build script call xcode-select to choose the compiler and headers you prefer each project to compile against. I've not had any issues having three versions of Xcode running thusly. (6, 7 and 7.1)

You must log in to answer this question.

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