49

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?

8
  • Did you try using another web browser on developer.apple.com/downloads ? Commented Apr 12, 2013 at 6:00
  • I have tried Chrome, Safari and Firefox (and reset all three of them). Commented Apr 12, 2013 at 17:17
  • One solution could be finding a torrent or Direct-Download link for this ... But It might not be as secure as a file from Apple... Commented Apr 12, 2013 at 18:06
  • I considered that. It seems a bit silly to have to go all the way around when it should be so simple, but you're right, it may be a solution. Commented Apr 12, 2013 at 18:16
  • Or maybe you could ask someone else to download it for you. Commented Apr 12, 2013 at 18:18

9 Answers 9

54

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.

5
  • 1
    this is silly, but actually works. Thanks! Commented Jan 3, 2014 at 4:38
  • 1
    Doesn't work here... says --install is not a valid option.
    – Matt
    Commented Mar 11, 2014 at 20:35
  • @Matt What version of OS X are you running? Commented May 3, 2014 at 14:58
  • By now, 10.9 Mavericks
    – Matt
    Commented May 3, 2014 at 15:03
  • Want to share link Xcode Command Line Tools that show instructions along with snapshot. I am beginner and so for me it was helpful. Commented Jul 29, 2016 at 9:12
12

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.

2
  • I have tried Chrome, Safari and Firefox (and reset all three of them) to no avail, and restarted my computer. I don't have access to another at the moment, but I'll try as soon as I can. Commented Apr 12, 2013 at 16:49
  • If you are an admin, you can create another account and test with that. That would avoid any corrupt preferences or cache files.
    – Ɱark Ƭ
    Commented Apr 30, 2013 at 19:50
4

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 alternative xcode-select --install + osascript solution above.
4
  • Have had an extremely frustrating time trying to get to the download page on apple (enter un/pw then takes you to a different login screen, enter un/pw and it takes you to update your account details screen). This was the solution that finally allowed me to get the direct download link. Thanks.
    – Aidan Kane
    Commented Jun 13, 2015 at 11:23
  • Yes, I can empathize with this frustration... Apple has decided to keep their download links secret and only accessible to people who have logged into the developer site. Although there are ways around this that involve either manually logging in & grabbing cookies, or some automation tool that either automates the browser or makes multiple requests to POST to the login form, and allows the final request to use the same authentication cookies... these can be difficult and fragile to implement & base an installation script on.
    – TrinitronX
    Commented Jun 15, 2015 at 21:39
  • I've found that the most reliable way to automate XCode or CLTools deployment has been to first login manually, then save the appropriate .dmg file locally on a fileserver. Then the automation script can simply download the .dmg from the local fileserver "package repo" and proceed with install.
    – TrinitronX
    Commented Jun 15, 2015 at 21:39
  • @AidanKane: You may also be interested in some of my related answers for more context & scripts: Install Command Line Tools completely from Command Line, Fully Automated XCode Installation
    – TrinitronX
    Commented Jun 15, 2015 at 21:43
0

I experienced the same problem. Just uncheck the filter for "Applications" on the left bar, and you'll be able to see the download list.

0

If you prefer to avoid Xcode all together you can utilize the OSS GCC open-source project on Github and install manually.

curl -O http://cloud.github.com/downloads/kennethreitz/osx-gcc-installer/GCC-10.7-v2.pkg
sudo installer -pkg ./GCC-10.7-v2.pkg -target /
rm -f ./GCC-10.7-v2.pkg;
0

xcode-select --install still works in macOS Sierra 10.12.6 to get this to prompt you to install the command line tools

-2

It seems to have disappeared from the list of downloads. I got nothing using Chrome, then switched to Safari and then the search started working.

But no results for "Command Line Tools"

1
  • It is there for me, just listed on the downloads page no search needed
    – mmmmmm
    Commented Apr 30, 2013 at 18:01
-3

Once Xcode is installed, the command-line tools can be installed by launching Xcode and following those steps:

  1. Xcode > Preferences... > Downloads > Components
  2. Install the Command Line Tools package

Read more at: http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-mac-os-x/index.html#ixzz3JX4GluRq

1
  • 1
    The OP says "I would rather not install the entirety of Xcode "
    – mmmmmm
    Commented Nov 19, 2014 at 16:55
-4

I had a similar problem in Firefox, but just cleared the cookies, and it was good.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .