更新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

解决方案:

  1. 下载对应的 CommandLineTools,下载地址:https://developer.apple.com/download/all/
  2. 下载后按步骤安装
  3. 终端内执行命令:sudo xcode-select --switch /Library/Developer/CommandLineTools/

更新系统后如果使用 git 后出现如下错误:
在这里插入图片描述
则按照如下方法进行:

  1. xcode-select -p
  2. sudo xcode-select -r
  3. xcode-select -p

然后就可以正常使用。

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐