MacOS升级后使用Git报错:xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)

时间:2022-01-29 17:55:50

MacOS升级到10.15 Catalina后,在命令行执行shell脚本时,报错:

The default interactive shell is now zsh.
To update your account to use zsh, please run chsh -s /bin/zsh.
For more details, please visit https://support.apple.com/kb/HT208050.
~ | git
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

搜索了下,找到的解决方案是,重新安装命令行工具即可。

执行以下命令,完成重新安装命令行工具:

$ xcode-select --install

有些人使用的是重置:

$ xcode-select --reset

大家可以根据都可以尝试下。