xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools

212 阅读1分钟

Git 报错:

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

翻译:xcrun:error:无效的活动开发人员路径(/Library/developer/CommandLineTools),缺少xcrun,位置为:/Librare/developer/CommandLineTools/usr/bin/xcrun

image.png

为什么报错

报错来看,是Xcode command line tools丢失了
每次更新macOS系统版本,都要重新安装Xcode,因为新系统版本和原Xcode版本不适配了。

解决

重新安装Xcode Command Line Tools。终端输入xcode-select --install

image.png

同意后下载和安装。

为什么更新系统后会这样报错?

Xcode command line tools每次升级 macOS 都要安装一次,它是在macOS上进行软件开发的必要工具集。新版本macOS可能与Xcode工具版本不兼容。