我升级到 macOS Sierra(以及后来的 Mojave),我试着在终端运行 git 命令,但是它一直显示如下的错误:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
我该如何解决?
Table of contents
答
打开终端并且运行如下的命令:
xcode-select --install
这将会下载并且安装 Xcode 开发工具并且解决这个问题。安装的时候需要同意许可协议。作为后续步骤,如果你有多个版本或者希望命令行工具在没有 Xcode 的情况下运行,则可能需要重置 Xcode 的路径。
xcode-select --switch /Applications/Xcode.app
xcode-select --switch /Library/Developer/CommandLineTools
我在这个问题中找到了解决方案,命令行工具无效。
您可能会收到一条错误消息:“无法安装该软件,因为它当前无法从软件更新服务器获得”。在这种情况下,xcode-select --reset 的工作方式与 akozin 相同