How to download the Command Line Tools for Xcode without the Downloads for Developers webpage?
I'm trying to install the Command Line Tools for Xcode so that I can use homebrew to install some packages I need for some rudimentary programming exercises; I would rather not install the entirety of Xcode (again) as it's pretty bulky for something I rarely use, and I prefer a minimalistic IDE. Supposedly, Apple has released the command line tools separately, but for whatever reason, when I sign into the Downloads for Developers page, I get some sort of weird error where the page will not populate with downloads the majority of the time, and even when it will (rarely) I can't find the command tools I'm looking for. Apparently you can also download the OSX GCC Installer from Kenneth Reitz's blog, but it seems to be obsolete now that there's an official Apple version.
Are there any other avenues I can pursue? What could be going on with the website?
The command line tools aren't offered via Xcode 5.0.1, but I was able to install them via this terminal command.
xcode-select --install
It will prompt you that it needs the command line tools and will offer to install them. Worked like a charm for me.
Indeed you can download them from the Apple Developer downloads page.
If the page isn't working, I would follow Matthieu's advice and try another browser or computer.
Post-2021
Here is a script that will automate the install process for you:
# Try the AppleScript automation method rather than relying on manual .xip / .dmg download & mirroring
# Note: Apple broke automated Xcode installer downloads. Now requires manual Apple ID sign-in.
# Source: https://web.archive.org/web/20211210020829/https://techviewleo.com/install-xcode-command-line-tools-macos/
xcode-select --install
sleep 1
osascript <<-EOD
tell application "System Events"
tell process "Install Command Line Developer Tools"
keystroke return
click button "Agree" of window "License Agreement"
end tell
end tell
EOD
Older Solution (pre-2021)
You can download the XCode 4.x
CLTools packages from their official download site via direct links.
Here is a script that will automate the install process for you 1.
To find updated links for the tools, you can use this command:
curl -Ls https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/index-3905972D-B609-49CE-8D06-51ADC78E07BC.dvtdownloadableindex | plutil -convert json -o - - | python -mjson.tool | less
[1] Please don't abuse/overload their servers
EDIT: (2021-2022) This URL appears to have an invalid SSL certificate. The curl
command (if run in verbose -v
mode) shows that the https
certificate is invalid:
* Server certificate:
* subject: C=US; ST=Massachusetts; L=Cambridge; O=Akamai Technologies, Inc.; CN=*.test.edgekey.net
* start date: Sep 24 00:00:00 2021 GMT
* expire date: Sep 23 23:59:59 2022 GMT
* subjectAltName does not match devimages.apple.com.edgekey.net
* SSL: no alternative certificate subject name matches target host name 'devimages.apple.com.edgekey.net'
The old URL now returns an SSL error. The curl
command must now use the -k / --insecure
flag to work around the SSL certificate validation issue.
curl --insecure -Ls https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/index-3905972D-B609-49CE-8D06-51ADC78E07BC.dvtdownloadableindex | plutil -convert json -o - - | python -mjson.tool | less
Note:
- This URL now appears to have broken SSL certificates, and the latest version available is
Xcode.CLTools.10.8 version 2014.4
(command_line_tools_for_osx_mountain_lion_april_2014.dmg
) - The
curl
command above now has the-k
flag added to work around this certificate validation issue. Be aware that the-k / --insecure
command line option flag will bypass SSL certificate security checks. This is insecure and there is no way to verify using a PKI + CA chain of trust that this domain is trustworthy and still owned by Apple. It's recommended to use the alternativexcode-select --install
+osascript
solution above.