How to access gcc and other build tools of Xcode 4.3 or newer in console

Apple announced Xcode 4.3 for OSX Lion and 4.4 for OSX Mountain Lion last week. The major difference is that Xcode no longer provide an installer which is good thing because you now could update Xcode with AppStore in the future, plus it is much easier to carry the development environment with you. However, there is a little problem with this new version of Xcode, is that all command line toolsets and compilers are not visible in terminal. A simple fix is to update your PATH env:

export PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH

Please be noted that clang does not reside in /Developer/usr/bin, it is now in /Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Now you could access to gcc, g++, git or any toolsets bundled with Xcode. For your convenience, it is recommended to include it in your .bash_profile.

About these ads

About Jones Lee

Nothing much about me..

9 responses to “How to access gcc and other build tools of Xcode 4.3 or newer in console

  1. Thats very helpful, thank you. but is the /Developer exist? because after installing Xcode 4.3 nothing /Developer there. its all under the Xcode folder.

  2. You can install these additional tools directly in Xcode :
    Preferences > Downloads > Command Line Tools > Install

  3. Thanks! Much faster to update path than to download another 170mb ;)

  4. Thank you to all who took the time to post these solutions.
    Your help is appreciated.

  5. Jim Taylor

    I found I had to go with Cyril Suzat’s method (disclosure I’m not a full time XCode dev)

  6. Pingback: icall-research.net » Blog Archive » Installing TrEd on Mac OS X Lion

  7. Josh

    Or just open the Command Line Tools from within the Xcode preferences (or just download them from the Apple Dev Center)

  8. asveikau

    Sent here via a Google search.

    It is a bad idea to just update PATH instead of installing the “command line tools” package, as Eddy suggests in comments above. PATH is just one issue. If you poke around in the XCode bundle you’ll see the SDK files (headers, etc.) for 10.7, etc. If you do nothing but patch PATH you’ll have a C compiler in your PATH but it won’t have any idea about standard headers. This will choke most configure scripts and any non-trivial C program, unless you point the compiler at the right SDK through -isysroot. By installing the “command line tools” package you set up a sane C development environment that works out of the box, not some messed up half-setup that requires very long and convoluted command lines just to build “hello world”.

  9. Pingback: How to access gcc and other build tools of Xcode 4.3 or newer in console | Ragnarok Connection

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: