17 年买的 mac,发现很多软件都无法安装,于是升级 mac os 到 10.13,从官网下载 10.13 版本,之后升级,升级还算顺利。但使用 git 的时候发现出现问题了。
使用 git 出现如下错误
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
简单查了需要安装 xcode,通过 App Store 安装 xcode 发现,App Store 的 XCode 需要 13.x 版本的 mac os。
从官网下载 10.13 版本对应的 xcode。
安装完 xcode 之后,通过如下命令指定 CommandLineTools 的位置。
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
至此 git 可以使用了。