Mojave升级后Command Line Tools与git失效

升级Mojave后,打开终端,首行即报错:

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

并且无法使用git、无法brew update(升级brew)。

这是因为旧系统的Command Line Tools及其内git已不可用,而brew update需要git。

按照论坛的说法先后尝试了以下操作:

  • 执行xcode-select --install,弹出对话框,点确认以安装 Command Line Tools。但安装失败,提示大意为“无法获得软件”。疑似系原安装Xcode后卸载所致。
  • 登录More Downloads for Apple Developers,选择当前系统版本对应的“Command line tools ”下载 (我的系统是OS X 10.14,下载“Command line tools (OS X 10.14)” ),安装之。
  • 最终效果:新开一个终端,不再出现xcrun: error: invalid active developer path报错,git可使用,可以brew update
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容