How do I get the command line builds tools installed with 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 there (in the bundle, under Contents/Developer), but none of the appropriate environment variables set to use them.
Is there a script somewhere I can run that will setup my environment to support building from the command line?
Instead of installing the "official" build of the command line tools from Apple, you can also install Kenneth's build from here:
https://github.com/kennethreitz/osx-gcc-installer
It doesn't even require XCode if all you are after is the command line tools.
xcode command line tools can be downloaded from here: https://developer.apple.com/downloads/index.action#
April 2014 version direct download link (for developers who just want to get started right away) https://developer.apple.com/downloads/download.action?path=Developer_Tools/command_line_tools_os_x_mavericks_for_xcode__april_2014/command_line_tools_for_osx_mavericks_april_2014.dmg
If you want to use the version of tools provided in XCode itself you can use xcrun (e.g.
xcrun git
). From the help at the bottom of the download preference pane: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, tryxcode-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:
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:
Xcode 4.x screenshot:
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.
If you don't have a free Apple developer account, register for one
Login to https://developer.apple.com/downloads
Download the "Command Line Tools for Xcode" appropriate for your version of OSX
For me, that was "Command Line Tools (OS X Mountain Lion) for Xcode - April 2014"
Copy the dmg file to your remote
In the following command, I'm using scp to securely copy the file from my local computer to the remote named
remote
ssh to your remote
mount the dmg file on the remote
Here, I'm using hdiutil to mount the image
install the package contained in the dmg
Here, installer must be run with
sudo
because this package needs to be installed on the root file systemunmount the dmg file
delete the dmg file from the remote; optional
I see no purpose keeping it around, but you can if you want.
UPDATED: On Lion 10.7.4 the Command Line Tools are already available from withing XCode. You can get it freely from App Store.
The GCC for OSX won't compile some packages obtained from macports. https://github.com/kennethreitz/osx-gcc-installer/downloads