xcode-select -switch不起作用:活动开发者路径不存在

时间:2013-07-24 12:37:44

标签: macos xcode5

我已经安装了Xcode 5开发人员预览版3.之前我有开发人员预览版2,现在,有时在我的终端中我看到错误,例如当我尝试通过选项卡自动完成某些命令时:

error: active developer path ("/Applications/Xcode5-DP2.app/Contents/Developer") does not exist, use xcode-select to change

我尝试通过执行命令来更改此目录:

sudo xcode-select -switch /Applications/Xcode5-DP3.app/Contents/Developer

现在xcode的路径正确,因为命令

sudo xcode-select -print-path

告诉我结果:

 /Applications/Xcode5-DP3.app/Contents/Developer    

但我仍然在终端中看到相同的错误,请参阅附件:https://dzwonsemrish7.cloudfront.net/items/120Z1S0b1Q302w3J453U/Screen%20Shot%202013-07-24%20at%2016.34.23.png?v=45e9961b

6 个答案:

答案 0 :(得分:36)

一次发生在我身上:xcode-select -print-path确实坚持了同样的价值并没有改变。它似乎总是等于DEVELOPER_DIR环境变量。根据xcode-select的手册页:

  

设置DEVELOPER_DIR时,将使用其值而不是值   最后传递给-switch xcode_path

因此,取消设置DEVELOPER_DIR使xcode-select -switch正常工作。

答案 1 :(得分:30)

尝试更改xcode本身的路径。 enter image description here

答案 2 :(得分:3)

如果您这样做:

man xcode-select

它告诉您使用路径:

xcode-select /Application/Xcode-DP4.app

因为我刚刚切换到DP4进行测试。这对我有用。我没有看到它指向任何.app内容。我想这可能是从以前的版本改变了......

答案 3 :(得分:1)

如果您正在运行测试版。路径应该是这样的。

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

答案 4 :(得分:1)

有时,空格字符不允许正确使用路径。因此,您可能更喜欢使用\字符在路径中添加空格,如下所示;

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

答案 5 :(得分:0)

我更改Xcode应用程序的名称后出现此错误。我将Xcode应用程序更改为Xcode8.1.app。然后我运行命令

sudo xcode-select -switch /Applications/Xcode8.1.app/Contents/Developer

现在一切正常。

不确定你是否在我的情况下,你的问题是否得到解决。也许帮助另一个。