以前的小米鼠标太费电了,于是就买了一个第二代的小米鼠标,顺便把 MacOS 的系统给升级了一番,结果打开 IntelliJ IDEA 后发现 Git 无法使用了。完整错误提醒信息如下所示:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

刚开始升级后,我以为是 Git 出问题了,但是试了试 SourceTree,发现没问题。
然后在 iTerm2 中尝试执行下面命令:
git --help
结果也出错。
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
然后一通谷歌,得知需要安装 xcode-selcet

然后执行 xcode-select –install 进行 command line developer tools 安装。
xcode-select --install
安装完成后,在命令行中输入 git –help,发现 git 可以使用了。然后重启 idea 开发工具,git 也可以正常使用了!
: » 修复Mac升级后IntelliJ idea报Cannot Run Git问题
原创文章,作者:Carrie001128,如若转载,请注明出处:https://blog.ytso.com/tech/aiops/252972.html