xcodemacoscommand-line-tool

How to install Xcode Command Line Tools


How do I get the command-line build tools installed with the current Xcode/Mac OS X v10.8 (Mountain Lion) or later?

Unlike Xcode there is no installer, it's just a bundle.

It looks like all the command line tools are in the bundle, under Contents/Developer, but none of the appropriate environment variables are set to use them.

Is there a script I can run that will set-up my environment to support building from the command line?


Solution

  • Xcode 5.1 and OSX 10.9. (also works with Xcode 5.1.1 + OSX 10.10)

    xcode-select --install worked with version 2333, failed with version 2003. So, try xcode-select --install and if that does not work download as described below.

    In early February 2014 xcode-select --install has been reporting that "Can't install the software because it is not currently available from the Software Update server". In late February 2014 the command started only displaying help. The solution is to download directly, see "Separate Download" below.

    Xcode 5.0.1 and OSX 10.9

    With Xcode 5.0.1 and Mavericks 10.9 the command line tool is no longer available through Xcode. Instead they must be downloaded from the Apple Developer Tools site: https://developer.apple.com/downloads/index.action. This requires signing in with a developer account.

    Or via terminal (from the release docs): The Command Line Developer Tools package can be installed on demand using "xcode-select --installā€ and the installed tools will be automatically updated using Software Update. OS X 10.9 is required for this feature. For earlier versions, continue to use the in-app download in Xcode.

    Running the command in terminal produces the following GUI:enter image description here

    Inside Xcode (5.0)

    Xcode includes a new "Downloads" preference pane to install optional components such as command line tools, and previous iOS Simulators. To open this pane click the "Xcode" button in the top left of the screen near the Apple logo, then click "Preferences", then click "Downloads".

    Xcode 5.0 screenshot: enter image description here

    Xcode 4.x screenshot: screenshot of downloads pane

    Separate Download

    If you do not have Xcode, they are available as a separate download from Apple:

    Go to developer.apple.com/downloads/index.action, and sign in with your Apple ID (the download's free). In the pane on the left, search for "command line tools" and choose the package appropriate to your version of OS X. Requires Mac OS X 10.7.3 or later.