我刚刚从优胜美地升级到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,从来没有。 有人有办法吗?


当前回答

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

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

其他回答

对于那些在升级后也有heroku命令行工具问题的人,我还必须在我的终端中做以下工作:

xcode-select --install 
brew install heroku/brew/heroku
brew link --overwrite heroku

看来升级到High Sierra除了迫使我重新安装xcode工具外,还扰乱了我的符号链接。我一直得到'不是一个目录'错误:

▸ stat /Users/mattymc/.local/share/heroku/client/bin/heroku: not a directory  
▸ fork/exec /Users/mattmcinnis/.local/share/heroku/client/bin/heroku: not a directory 

希望能帮你省一个小时:)

对我来说,在我删除了Xcode之后,我必须切换活动开发人员路径,如下所示: Sudo xcode-select -s /

更新到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

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

为我工作。

在莫哈韦沙漠

卸载旧版本的命令行工具:

sudo rm -rf /Library/Developer/CommandLineTools

下载并安装命令行工具10.14 Mojave