我该如何解决“错误:没有开发人员目录在/ Developer”?

我刚把XCode升级到4.3.1。 我正在使用脚本来构build(然后通过Testflight部署)我的应用程序。 但是我现在收到这个错误:

错误:在/ Developer中找不到开发人员目录。 运行/ usr / bin / xcode-select更新开发者目录path。

我没有/开发人员目录在我的机器:我该如何解决?

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

你也可以这样做,而不是…

 sudo ln -s /Applications/Xcode.app/Contents/Developer /Developer 

你们所回答的一切都是正确的。 但是对于那些遇到以下错误的人来说却缺less一个步骤:

错误:

  "xcode-select: Error: Path "/Applications/Xcode.app/Contents/Developer" is not a directory." 

缺失步骤:

 Double click your xcode 432.dmg. Now don't double click the xcode.app to use it. Instead copy it /Applications folder and then open it from there to install xcode. 

现在使用terminal命令

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

而已。 你的错误不会再发生,Filemerge现在可以工作。

这对我解决了:

大多数情况下,当你安装了更新版本的xcode时,会发生这个错误。 而命令行工具还没有被初始化。

要解决这个问题:去Xcode首选项>位置(选项卡)>下面的选项是命令行工具。 请select工具的Xcode版本。

示例(对于Xcode 8.3.3):在Xcode首选项>位置(选项卡)下进入>底部的选项是命令行工具。 selectXcode 8.3.3(7D1014)。