Xcode is installed but I can't use xcode-select "xcode-select: command not found"

Kristy Hughes picture Kristy Hughes · Feb 10, 2015 · Viewed 18.7k times · Source

I tried installing XCode 6.1.1 from both developer.apple.com and through the app store. I also tried installing the developer tools developer.apple.com.

Either way, it doesn't install xcode-select for some reason.

xcode-select --install
-bash: xcode-select: command not found

I made sure it could see /usr/bin in my PATH variable

k$ echo $PATH
/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/System/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/texbin:/Users/k/.rvm/bin:/Users/k/.rvm/bin

But turns out that xcode-select not in the bin folder:

k$ ls /usr/bin/x*
/usr/bin/xar             /usr/bin/xgettext5.18.pl /usr/bin/xpath5.18
/usr/bin/xargs           /usr/bin/xip             /usr/bin/xslt-config
/usr/bin/xattr           /usr/bin/xjc             /usr/bin/xsltproc
/usr/bin/xattr-2.6       /usr/bin/xml2-config     /usr/bin/xsubpp
/usr/bin/xattr-2.7       /usr/bin/xml2man         /usr/bin/xsubpp5.16
/usr/bin/xcrun           /usr/bin/xmlcatalog      /usr/bin/xsubpp5.18
/usr/bin/xed             /usr/bin/xmllint         /usr/bin/xxd
/usr/bin/xgettext.pl     /usr/bin/xpath
/usr/bin/xgettext5.16.pl /usr/bin/xpath5.16

Or even on my system at all:

k$ sudo find / | grep xcode-select
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/share/man/man1/xcode-select.1
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/share/man/man1/xcode-select.1
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
/Users/k/.Trash/Xcode 00-40-10.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/share/man/man1/xcode-select.1
/Users/k/.Trash/Xcode 00-40-10.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/share/man/man1/xcode-select.1
/Users/k/.Trash/Xcode 21-31-08-775.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/share/man/man1/xcode-select.1
/Users/k/.Trash/Xcode 21-31-08-775.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/share/man/man1/xcode-select.1
/Users/k/.Trash/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/share/man/man1/xcode-select.1
/Users/k/.Trash/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/share/man/man1/xcode-select.1/usr/share/man/man1/xcode-select.1

What should I do?

Other XCode information: Xcode hung when clicking "Accept Conditions" on the first instance of opening it, so I had to force quit it. Xcode will now open, but hangs if I try to go to the "Locations" section of Preferences. Here is a list of errors from Console that I got during opening Xcode for the first time and going to the "Location" section of Preferences http://i.stack.imgur.com/YyMgR.png

Thanks for you help!

Answer

Kristy Hughes picture Kristy Hughes · Apr 26, 2015

I solved this problem by manually adding the file /usr/bin/xcode-select, which is apparently very small.

$ echo -e '#!/bin/sh\nexec"$@"' > /usr/bin/xcode-select
$ sudo chmod +x /usr/bin/xcode-select