您的位置:首页 > 运维架构

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

2017-12-10 21:38 731 查看
引言: Mac系统下运行git之时的错误问题之解决办法

问题起源

在mac下,需要下载github下的某个项目:

git clone xxx

但是报出了错误信息。错误信息如下:

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


问题分析

初步怀疑是git的问题,所以,尝试查看git的帮助信息:

git -h

结果仍然报出类似的错误信息:

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


尝试检查一下git是否已经正确安装:

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已经被修复好了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  git mac
相关文章推荐