更新mac 系统后,git 突然报错不能用了,相关错误大致如下:
git: error: sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find git 2> /dev/null' failed with exit code 34304: (null) (errno=Invalid argument)
问题原因:使用git的时候需要CommandLineTools
解决方案:
- 下载对应的 CommandLineTools,下载地址:https://developer.apple.com/download/all/
- 下载后按步骤安装
- 终端内执行命令:
sudo xcode-select --switch /Library/Developer/CommandLineTools/
更新系统后如果使用 git
后出现如下错误:
则按照如下方法进行:
xcode-select -p
sudo xcode-select -r
xcode-select -p
然后就可以正常使用。