mac更新后git不可用

更新后报错

错误提示如下:

dyld: Library not loaded: @rpath/libswiftCore.dylib
  Referenced from: /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild
  Reason: image not found
git: error: unable to locate xcodebuild, please make sure the path to the Xcode folder is set correctly!
git: error: You can set the path to the Xcode folder using /usr/bin/xcode-select -switch

查找解决方案

网上查到输入下面的命令

sudo xcode-select --switch /Library/Developer/CommandLineTools/

仍然报错:

xcode-select: error: invalid developer directory '/Library/Developer/CommandLineTools/'

安装xcode-select

xcode-select --install

根据提示的弹框安装xcode-select
再次执行如下命令

sudo xcode-select --switch /Library/Developer/CommandLineTools/

执行完不报错,ok

报另外一种错

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

同样安装 xcode-select --install, 安装完之后就ok啦

你可能感兴趣的:(其他)