前段時間剛升級了macOS,今天在終端使用Git的時候報了一個詭異的錯:Failed to extract git version from `git --version` ("xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun\n") (RuntimeError)
查了一會也不知道具體的原因,但是找到了解決方案
1.萬能的重裝
終端輸入 : xcode-select --install
2.切換路徑(我用的是這個方法
終端輸入: sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
然後輸入密碼執行命令即可