今天更新了 macOS 版本到 macOS Sonoma14.5,发现 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 17920: (null) (errno=Invalid argument)
xcode-select: Failed to locate 'git', requesting installation of command line developer tools.
解决方案也很简单:
sudo xcode-select -switch /Library/Developer/CommandLineTools
输入开机密码后回车,然后重启下终端就好了!