Macos下的xcrun error:invalid active developer path

问题的提出

在macos下想使用brew安装某个文件,结果得到了如下错误信息:
执行命令: brew install mpv

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Error: Failure while executing; `git config --local --replace-all homebrew.private true` exited with 1.

问题的分析

执行了如下命令:

brew update

结果显示:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Error: Failure while executing; `git config --local --replace-all homebrew.private true` exited with 1.
ZBMAC-C02W25PEH:Downloads chenjunfeng1$ brew update
Already up-to-date.

可以断定,这个应该是某个配置的错误问题造成的。

问题的解决

于是只好求助于google了,经过一番查找,有人建议使用如下命令:

sudo xcode-select --install

提示如下界面,这是一个安装提示:

![在这里插入图片描述](https://img-blog.csdnimg.cn/20181028162049674.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2JsdWVoZWFydDIw,size_27,color_FFFFFF,t_70)

整个过程会持续大约3分钟左右,依据网速不同而有差异。
在安装过程中,有可能会发现如下问题:
install error
针对这个问题,可以采用如下方式处理:
1)升级xcode到最新版本,然后执行xcode-select –install
主要原因是由于在macos升级之后,当前xcode版本比较低。所以升级一下即可。
2)或者去developer apple网站上手工下载
https://developer.apple.com/download/more/
安装成功后,就可以基于brew正常安装软件了。

 brew install wget
==> Installing dependencies for wget: libidn2
==> Installing wget dependency: libidn2
==> Downloading https://homebrew.bintray.com/bottles/libidn2-2.0.5.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libidn2-2.0.5.mojave.bottle.tar.gz
?  /usr/local/Cellar/libidn2/2.0.5: 68 files, 669KB
==> Installing wget
==> Downloading https://homebrew.bintray.com/bottles/wget-1.19.5.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring wget-1.19.5.mojave.bottle.tar.gz
?  /usr/local/Cellar/wget/1.19.5: 50 files, 3.7MB

总结

原因是xcode缺少了一个组件,这里安装即可。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值