xcrun:错误:活动开发者路径(“/Applications/Xcode.app/Contents/Developer”)不存在

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35009531/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 18:16:03  来源:igfitidea点击:

xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist

xcodepathxcrun

提问by devB78

I'm having xcode issues when I try to use brew and git:

当我尝试使用 brew 和 git 时,我遇到了 xcode 问题:

xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist, use xcode-select --switch path/to/Xcode.appto specify the Xcode that you wish to use for command line developer tools (or see man xcode-select)

xcrun: 错误:活动开发人员路径(“/Applications/Xcode.app/Contents/Developer”)不存在,用于xcode-select --switch path/to/Xcode.app指定您希望用于命令行开发人员工具的 Xcode(或参见man xcode-select

I can type xcode-select and it shows that the command exists. When I type xcode-select -pit shows:

我可以输入 xcode-select 并显示该命令存在。当我输入xcode-select -p它显示:

/Applications/Xcode.app/Contents/Developer

/Applications/Xcode.app/Contents/Developer

but when I do which xcode-select, it gives me:

但是当我这样做时which xcode-select,它给了我:

/usr/bin/xcode-select

/usr/bin/xcode-select

I've tried to use the command switch and install again via Apple Developer site but none of these options have work so far... How can I fix this?

我尝试使用命令开关并通过 Apple Developer 站点再次安装,但到目前为止这些选项都不起作用......我该如何解决这个问题?

回答by devB78

I tried that and it didn't work but I found the answer. I just had to reset the developer's path:

我试过了,但没有用,但我找到了答案。我只需要重置开发人员的路径:

$ sudo xcode-select --reset

Now everything is normal

现在一切正常

回答by Harjot Singh

Mostly this error occurs when you have installed a newer version of xcode. And the command line tools are yet to be initialized.

大多数情况下,当您安装了较新版本的 xcode 时会发生此错误。命令行工具尚未初始化。

To resolve this: Go under Xcode Preferences > Locations (tab) > And the bottom options is Command Line Tools. Please select the Xcode version for tools.

要解决此问题:转到 Xcode 首选项 > 位置(选项卡)> 底部选项是命令行工具。请为工具选择 Xcode 版本。

Example (For Xcode 10.0 (10A255) ): Go under Xcode Preferences > Locations (tab) > And the bottom options is Command Line Tools. Select Xcode 10.0 (10A255).

示例(对于 Xcode 10.0 (10A255)):进入 Xcode Preferences > Locations (tab) > 底部选项是 Command Line Tools。选择 Xcode 10.0 (10A255)。

For more details please see the attached image. Hope it helps.

有关更多详细信息,请参阅所附图片。希望能帮助到你。

-- Thanks

- 谢谢



Select Command Line Tools

选择命令行工具

回答by Bharath Kumar

I have faced the same issue as I have uninstalled the XCode abruptly, running the below command (from Terminal) helped me to resolve this.

我遇到了与突然卸载 XCode 相同的问题,运行以下命令(从终端)帮助我解决了这个问题。

sudo xcode-select -switch /

回答by José Gil Ramírez

In my case, I had uninstalled Xcode and then issues with git cli started. I solved the problem running the following commands:

就我而言,我已经卸载了 Xcode,然后开始出现 git cli 问题。我解决了运行以下命令的问题:

$ sudo xcode-select -r
$ sudo xcode-select --switch /Library/Developer/CommandLineTools

and then validating new path with:

然后使用以下方法验证新路径:

$ sudo xcode-select -p

Hope this helps!

希望这可以帮助!

回答by bruceparker

Use this sudo xcode-select -switch /

使用这个 sudo xcode-select -switch /

This should solve the problem.

这应该可以解决问题。

回答by Tobi Nary

How about what the error suggests? Did you try that?

错误提示如何?你试过吗?

xcode-select --switch /Applications/Xcode.app

That should do the trick.

这应该够了吧。

回答by Nikolay Ignatyev

For me it helps to install Xcode CLI xcode-select --installafter uninstalling XCode (I don't develop for the OSx or iOS)

对我来说xcode-select --install,卸载 XCode 后安装 Xcode CLI 会有所帮助 (我不为 OSx 或 iOS 开发)

Then I could successfully build downloaded source with make

然后我可以成功地构建下载的源代码 make

回答by Pinimo

I had the same problem and had to remove completely Developer tools, and reinstall:

我遇到了同样的问题,不得不完全删除开发人员工具,然后重新安装:

$ rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install

Tip: because Xcode had been improperly uninstalled, I had to manually (re)move the Xcode app, too:

提示:因为 Xcode 被不正确地卸载,我也不得不手动(重新)移动 Xcode 应用程序:

$ mv /Applications/Xcode.app/ /Applications/Xcode.app.bak

回答by Mir Mahfuz

Try error suggestion :

尝试错误建议:

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

And Then test Git Executable Path.

然后测试 Git 可执行路径。

enter image description here

在此处输入图片说明