首页 » Notebook » 正文

macOS 升级 Mojave 出现 xcrun: error: invalid active developer path 的解决办法

当升级到 macOS Mojave 之后,当尝试在命令行执行 git 的时候,出现了如下错误:

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

解决办法是打开 Terminal,执行如下命令:

xcode-select --install

这将下载并安装 xcode 开发者工具,之后就会修复这个问题。这个问题是因为需要你明确同意许可协议。如果你有多个版本的 Xcode 或者只需要命令行工具而非 Xcode,你可能需要重置 Xcode 的路径:

# 重置 Xcode 路径
xcode-select --switch /Applications/Xcode.app
# 使用命令行工具
xcode-select --switch /Library/Developer/CommandLineTool

 

本文共 1 个回复

  • zyx 2019/04/17 10:25

    不错

发表评论