Recently I updated Xcode on OS 10.9 to version 5.0.1 through the AppStore. It appeared to me that this update also updated command line tools, for example running gcc --version
produced
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
However answers here on SE indicate that this is not the case and that command line tools need to be downloaded and installed separately. I did this and ended up with the same tool versions, but with subtle differences. For example, now running running gcc --version
produces
gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
Is this how things are supposed to work — does this represent the expected behavior for current Xcode command line tools or is it peculiar to an installation via direct download (vs. installing along with Xcode through the AppStore; if that's even possible)?
And what's the significance of the change from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
to /usr/include/c++/4.2.1
?
The Command Line Tools Package is a small self-contained package available for download separately from Xcode and that allows you to do command line development in macOS. It consists of the macOS SDK and command-line tools such as Clang, which are installed in the /Library/Developer/CommandLineTools directory.
The name of the C compiler (that was installed along with the command line tools) is gcc. To check that this is now successfully installed, enter "gcc --version" at the prompt.
They allow programmers to compile programs and debug them, convert files, and perform a number of tasks for handling the resources required for making applications and other tools. Running the Terminal-based developer tool “make” on a system without the command line tools installed will prompt you to install them.
I'll structure my answer with a list so that you get the full picture, the answer to your main question being concluded in the last list item:
gcc
and g++
that point to Clang and Clang++ respectively have been kept in order to preserve backwards compatibility and since Clang is very much backwards compatible with GCC, there's no reason not to do so.xcode-select --install
in the Terminal app and follow the instructions.Given that the SDK's are now bundled and organized in a directory structure inside XCode.app bundle, the change in gxx-include-dir you noticed is due to the fact that now, /usr/include is merely a soft link now to the proper place for the specific includes:
$ls -l /usr/include
lrwxr-xr-x 1 root wheel 112 Feb 2 19:08 /usr/include -> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/
The last point, is not necessarily a bad thing and xcode-select(1)
command can now be used to manage the active SDK.
I hope this clarifies things a bit for those confused, since all these (quite big) changes were rolled out in classic Apple fashion, in complete and utter silence.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With