我刚刚从优胜美地升级到El Capitan(并复制了从El Capitan升级到Sierra的问题),当我尝试在终端内键入例如git状态时,我得到以下错误:

xcrun: error: invalid active developer path
 (/Library/Developer/CommandLineTools), missing xcrun at:
 /Library/Developer/CommandLineTools/usr/bin/xcrun

我没有安装Xcode,从来没有。 有人有办法吗?


当前回答

找到解决问题的方法了。

xcode-select --install

这将提示安装必要的命令行工具。

其他回答

更新到macOS 10.13.3后

更新macOS 10.13后,我必须安装 用于Xcode 9.3的命令行工具(macOS 10.13) 下载网址:https://developer.apple.com/download/more/

我尝试了xcode-select -install解决方案,但它没有帮助我,我从Sierra更新到High,发生了这样的情况,我的解决方案:

sudo xcode-select --reset

我将mac os升级到macOS High Sierra - 10.13.3,在尝试安装watchman(使用命令酿造安装watchman)时遇到了类似的问题。

运行命令:xcode-select——install,然后运行"brew install watchman" -一切正常!

更新到High Sierra 10.13.2

xcode-select—install ALONE不适合我。

从应用商店下载X-code xcode-select美元,安装 a.安装后可能需要在命令行中使用softwareupdate进行更新。$sudo softwareupdate -i "命令行工具(macOS High Sierra version 10.13) for Xcode-9.1" $sudo xcodebuild -license

即使你执行xcode-select -install,它也不能解决我的问题,因为它显示了一些网络错误。问题是它无法连接到应用商店。我做了以下来修复它。

打开密钥存储库 进入系统根目录,选择证书。 开放数字高保证EV。 展开信任部分,将其标记为从不信任。 重新启动系统,现在重复步骤1、2、3。并将信任策略标记为 返回使用系统默认值。

你的应用商店现在应该工作了,你应该能够运行xcode-select——install