当我输入 git init 时,我在尝试推送到 git 时遇到了这个错误。
xcrun:错误:无效的活动开发者路径 (/Library/Developer/CommandLineTools),缺少 xcrun:/Library/Developer/CommandLineTools/usr/bin/xcrun
我尝试了以下解决方案。
xcode-select —install
sudo xcode-select -switch
sudo xcode-select —install
brew doctor
brew update
brew upgrade
brew cleanup
这就是您需要做的所有事情:
$ xcode-select --install
您可以从下面屏幕截图中显示的 XCode 首选项中选择命令行工具。
您将收到输入密码的提示。
https://i.stack.imgur.com/shCHZ.png
1)
尝试输入“xcode-select -print-path
”并查看您看到的路径是否是您当前 Xcode 版本所期望的路径。
2)
如果你去:
https://developer.apple.com/downloads/
(您需要使用您的 Apple Developer 帐户登录)
在那里,您将看到“命令行工具”的链接。听起来您需要install MacOS 10.11 Command Line Tools for Xcode 7。
尝试:
sudo xcode-select -r
通过这种方式,它会取消设置任何用户指定的开发者目录,以便通过默认搜索机制找到开发者目录。
如果您有 Catalina 和 Xcode 11 并且遇到此问题,请转到 Xcode Preferences 并选择 Location 选项卡,检查命令行工具下拉列表是否选择了 Xcode 11.0。如果 Xcode 11 不存在,那么您需要在此处下载并安装 Xcode 11 的命令行工具(选择正确的 Beta)
https://developer.apple.com/download/more/?=command%20line%20tools
xcode-select --install
的实际作用是什么/许可证检查如何工作?我检查了其中一个涵盖的可执行文件(在我的情况下为make
)的md5
,它在运行xcode-select --install
之前和之后是相同的。