简体   繁体   English

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

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

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.app to specify the Xcode that you wish to use for command line developer tools (or see man xcode-select ) xcrun: error: active developer path ("/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.我可以输入 xcode-select 并显示该命令存在。 When I type xcode-select -p it shows:当我输入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 站点再次安装,但到目前为止这些选项都不起作用......我该如何解决这个问题?

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现在一切正常

Mostly this error occurs when you have installed a newer version of xcode.大多数情况下,当您安装了较新版本的 xcode 时会发生此错误。 And the command line tools are yet to be initialized.命令行工具尚未初始化。

To resolve this: Go under Xcode Preferences > Locations (tab) > And the bottom options is Command Line Tools.要解决此问题:转到 Xcode 首选项 > 位置(选项卡)> 底部选项是命令行工具。 Please select the Xcode version for tools.请为工具选择 Xcode 版本。

Example (For Xcode 10.0 (10A255) ): Go under Xcode Preferences > Locations (tab) > And the bottom options is Command Line Tools.示例(对于 Xcode 10.0 (10A255)):进入 Xcode Preferences > Locations (tab) > 底部选项是 Command Line Tools。 Select Xcode 10.0 (10A255).选择 Xcode 10.0 (10A255)。

For more details please see the attached image.有关更多详细信息,请参阅所附图片。 Hope it helps.希望能帮助到你。

-- Thanks - 谢谢


选择命令行工具

In my case, I had uninstalled Xcode and then issues with git cli started.就我而言,我已经卸载了 Xcode,然后 git cli 开始出现问题。 I solved the problem running the following commands:我解决了运行以下命令的问题:

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

and then validating new path with:然后使用以下方法验证新路径:

$ sudo xcode-select -p

Hope this helps!希望这可以帮助!

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

sudo xcode-select -switch /

Use this sudo xcode-select -switch /使用这个 sudo xcode-select -switch /

This should solve the problem.这应该可以解决问题。

How about what the error suggests?错误提示如何? Did you try that?你试过吗?

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

That should do the trick.这应该够了吧。

For me it helps to install Xcode CLI xcode-select --install after uninstalling XCode (I don't develop for the OSx or iOS)对我来说,它有助于在卸载 XCode 后安装 Xcode CLI xcode-select --install (我不为 OSx 或 iOS 开发)

Then I could successfully build downloaded source with make然后我可以使用make成功构建下载的源代码

This error coming because xcode get deleted, corrupt or moved.出现此错误是因为 xcode 被删除、损坏或移动。 In my case i removed xcode from my Mac and faced the same issue.就我而言,我从 Mac 中删除了 xcode 并遇到了同样的问题。

I fixed it by simple two steps我通过简单的两步修复了它

  1. Open Terminal打开终端
  2. Simply run following command只需运行以下命令
sudo xcode-select -r

And now error has resolved.现在错误已经解决。 Hope it will helpful.希望它会有所帮助。

Try error suggestion :尝试错误建议:

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

And Then test Git Executable Path.然后测试 Git 可执行路径。

在此处输入图片说明

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

In my case such error occurred after I has tried to symbolicate crash report , and according to a manual, entered command export DEVELOPER_DIR=”/Applications/Xcode.app/Contents/Developer”在我的情况下,这样的错误发生在我尝试符号化崩溃报告之后,根据手册,输入命令export DEVELOPER_DIR=”/Applications/Xcode.app/Contents/Developer”

I tried some proposed here solutions but nothing helped.我尝试了一些这里提出的解决方案,但没有任何帮助。

Then I realized that I have added an environment variable DEVELOPER_DIR to my terminal and this led to error: "xcrun: error: missing DEVELOPER_DIR path:"然后我意识到我在终端中添加了一个环境变量DEVELOPER_DIR ,这导致错误: “xcrun:错误:缺少 DEVELOPER_DIR 路径:”

Then I've just reboot my terminal , that cleaned the environment variable and the error disappeared.然后我刚刚重新启动我的终端,清理了环境变量,错误消失了。

(FYI: environment variables may be checked with printenv command in terminal) (仅供参考:可以在终端中使用printenv命令检查环境变量)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 活动开发者路径 (\"/Applications/Xcode10.1.app/Contents/Developer\") 不存在 - Active developer path (\"/Applications/Xcode10.1.app/Contents/Developer\") does not exist “xcrun: error: active developer path ... does not exist, use xcode-select --switch” 试图运行 git 时。如何修复? - "xcrun: error: active developer path… does not exist, use xcode-select --switch" when trying to run git. How to fix? 安装 Xcode 时遇到问题:开发人员目录无效“/Applications/Xcode.app/Contents/Developer” - Trouble installing Xcode: invalid developer directory '/Applications/Xcode.app/Contents/Developer' 错误:无法运行/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/ibtool(没有这样的文件) - Error: Can't run /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/ibtool (no such file) xcode和avr arduino“命令/Applications/Xcode.app/Contents/Developer/usr/bin/make失败,出现退出代码2”错误。 - xcode and avr arduino “Command /Applications/Xcode.app/Contents/Developer/usr/bin/make failed with exit code 2” error. 错误:命令/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc失败,退出代码为1 - Error: Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1 Xcode 14:无法在 /Applications/Xcode.app/Contents/Developer/ 找到传输器 - Xcode 14: Could not find transporter at /Applications/Xcode.app/Contents/Developer/ 错误:命令/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang失败,退出代码为1 - ERROR: Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1 生成失败并显示错误命令/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc - Build failed with error Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc /Applications/Xcode.app/Contents/Developer/usr/bin/python3:没有名为 notebook 的模块 - /Applications/Xcode.app/Contents/Developer/usr/bin/python3: No module named notebook
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM