Xcode 已安装,但我无法使用 xcode-select "xcode-select: command not found"
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28441829/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode is installed but I can't use xcode-select "xcode-select: command not found"
提问by Kristy Hughes
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.
我尝试从 developer.apple.com 和应用商店安装 XCode 6.1.1。我还尝试安装开发者工具 developer.apple.com。
Either way, it doesn't install xcode-select
for some reason.
无论哪种方式,它都不会xcode-select
由于某种原因安装。
xcode-select --install
-bash: xcode-select: command not found
I made sure it could see /usr/bin
in my PATH
variable
我确保它可以/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
But turns out that xcode-select
not in the bin folder:
但事实证明,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
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
其他 XCode 信息:在打开它的第一个实例上单击“接受条件”时 Xcode 挂起,因此我不得不强制退出它。Xcode 现在将打开,但如果我尝试转到首选项的“位置”部分,则挂起。这是我第一次打开 Xcode 并转到首选项http://i.stack.imgur.com/YyMgR.png的“位置”部分时收到的来自控制台的错误列表
Thanks for you help!
谢谢你的帮助!
采纳答案by Kristy Hughes
I solved this problem by manually adding the file /usr/bin/xcode-select
, which is apparently very small.
我通过手动添加文件解决了这个问题,该文件/usr/bin/xcode-select
显然非常小。
$ echo -e '#!/bin/sh\nexec"$@"' > /usr/bin/xcode-select
$ sudo chmod +x /usr/bin/xcode-select
回答by user3058197
The accepted solution didn't work for me, so I wanted to share this in case it helps others. After manually installing Command Line Tools, this line did the trick (xcode-select
was in my /usr/bin/
folder):
接受的解决方案对我不起作用,所以我想分享它,以防它对其他人有帮助。手动安装命令行工具后,这一行就成功了(xcode-select
在我的/usr/bin/
文件夹中):
sudo xcode-select --switch /
回答by Jasmeet
Just run the following commands on terminal
只需在终端上运行以下命令
$ DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer/"
$ export DEVELOPER_DIR