Mac下xcrun: error: invalid active developer path问题解决方法

问题:git使用的时候回出现

LiuJiandeMBP:~ liujian$ git
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

查看git是否安装:

LiuJiandeMBP:~ liujian$ which git 
/usr/bin/git

提示git已经被正确安装好了。

问题再次分析

是否是git的安装包被破坏了呢?于是尝试重新安装一下:

brew install git

Error: The following formula:
git
cannot be installed as a binary package and must be built from source.
Install the Command Line Tools:
xcode-select --install
Error: Git must be installed and in your PATH!
Error: The following formula:
git
cannot be installed as a binary package and must be built from source.
Install the Command Line Tools:
xcode-select --install

惊奇地发现brew提示了如下信息,需要xcode-select重新安装。
于是执行安装xcode-select指令:

xcode-select –install

结果

在xcode-select指令安装好之后,在命令检查一下git指令的帮助信息:

git -h

可以正确输出相应的帮助信息,意味着git已经被修复好了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值