Xcode 4.5命令行工具 - xcode-select问题

时间:2012-10-08 11:30:31

标签: xcode xcodebuild

在OS X 10.8.2上安装Xcode CLT 4.5.1后,我在安装需要编译的原生ruby gems时遇到问题。

输出错误与运行xcrun -find:

相同
  

xcode-select:错误:未选择Xcode。使用xcode-select -switch或
  有关详细信息,请参阅xcode-select手册页(man xcode-select)。

xcode-select 指向哪个CLT位置,因为它不再位于/ Developer?

编辑:我没有安装Xcode应用程序,只有CLT。

6 个答案:

答案 0 :(得分:20)

新位置似乎是(确保以root身份运行):

sudo xcode-select -switch /Library/Developer/

答案 1 :(得分:10)

由于您的Xcode工具安装在/ usr / bin中,您应该

sudo xcode-select -switch /

答案 2 :(得分:5)

安装了XCode 4.5并安装了命令行工具,我不得不使用它来使MacPorts和其他类似的东西(如Ruby Gems或Perl CPAN模块安装)工作:

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/

我发现/ Library / Developer不起作用。请注意,Developer文件夹不在/ Library下,它位于应用程序包文件内容文件夹下。

我不确定为什么会这样,但谷歌搜索这个问题的人可能会来这里并想知道xcode-select常用的其他命令行选项,因此这个答案,即使它不是100%适用原始问题(在没有XCode的情况下安装命令行工具)。

答案 3 :(得分:2)

可能想要:

xcode-select -switch /Applications/Xcode.app

除非您有多个安装。如果你有一个安装(例如从App Store),这可能就是这个位置。如果你有多个安装,你可能知道你想要哪一个。

您也可以尝试从Xcode的Preferences > Locations > Command Line Tools弹出窗口中更新此值。

答案 4 :(得分:1)

打开XCode并转到偏好设置。

确认“命令行工具”

下有一个选项

一旦我指定了Xcode命令行工具版本,错误就消失了。 enter image description here

答案 5 :(得分:0)

我从@jbowes xcode-select -switch /Library/Developer/回答得更远了,但后来我点了这个:

xcrun: Error: failed to exec real xcrun. (No such file or directory)

我遇到了这个线程(OSX 10.8 xcrun (No such file or directory)),它引用了解决我问题的要点:

https://gist.github.com/thelibrarian/5520597

这很糟糕,但它似乎是仅通过命令行工具解决问题的唯一方法(即不是完整的XCode安装)。

相关问题