Xcode已安装,但我无法使用xcode-select" xcode-select:command not found"

时间:2015-02-10 21:10:29

标签: xcode macos xcode6.1

我尝试从developer.apple.com和app store安装XCode 6.1.1。我还尝试安装开发人员工具developer.apple.com。

无论哪种方式,由于某种原因它都不会安装xcode-select

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

我确保在/usr/bin变量

中看到PATH
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

但结果是xcode-select不在bin文件夹中:

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

甚至在我的系统上:

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

我该怎么办?

其他XCode信息: 点击"接受条件"在打开它的第一个例子,所以我不得不强行退出它。 Xcode现在将打开,但如果我尝试转到" Locations"偏好部分。以下是我第一次打开Xcode并进入"位置"偏好部分 http://i.stack.imgur.com/YyMgR.png

谢谢你的帮助!

3 个答案:

答案 0 :(得分:3)

我通过手动添加文件/usr/bin/xcode-select解决了这个问题,这显然非常小。

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

答案 1 :(得分:1)

接受的解决方案对我不起作用,所以我想分享一下以防万一。手动安装命令行工具后,这一行就行了(xcode-select在我的/usr/bin/文件夹中):

sudo xcode-select --switch /

答案 2 :(得分:-1)

只需在终端上运行以下命令

$ DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer/"

$ export DEVELOPER_DIR