OS X El Capitan系统下使用brew报错问题

解决Homebrew权限问题
本文介绍了如何解决Mac OS El Capitan系统中Homebrew遇到的权限问题。通过调整/usr/local目录的所有权和权限,可以有效解决Homebrew无法正常工作的问题。

今天想使用brew下载个工具,发现无端端报错了,不能正常使用。顿时心血来潮——又有博客写了

因为从10.11开始,对几个重要目录的权限苹果有了新的限制,特别是/usr目录,所以官方有一个解决方法:El_Capitan_and_Homebrew

这里我按照我的思路来解决这个问题!

报错如下内容

Error: The /usr/local directory is not writable.
Even if this directory was writable when you installed Homebrew, other
software may change permissions on this directory. Some versions of the
"InstantOn" component of Airfoil are known to do this.

You should probably change the ownership and permissions of /usr/local
back to your user account.
  sudo chown -R $(whoami):admin /usr/local

根据错误提示,我们只需要执行提示中最后一句指令sudo chown -R $(whoami):admin /usr/local

执行完指令之后,我们再使用brew doctor指令检测一下,按照提示操作就行。当然有些提示我们是可以忽略的。比如:

Warning: Suspicious git origin remote found.

With a non-standard origin, Homebrew won't pull updates from
the main repository. The current git origin is:
  https://git.coding.net/homebrew/homebrew.git

Unless you have compelling reasons, consider setting the
origin remote to point at the main repository, located at:
  https://github.com/Homebrew/homebrew.git

这里提示我有可疑的brew源地址,但是其实这个源地址是安全的,因为是我自己设置的。所以我忽略了这个警告。

另外一个警告是这样子的:

Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
    carthage
    python

道理一样,我们按照提示执行指令brew link python

解决完提示的问题之后就可以正常使用啦!

如果什么都不行的话,试下执行xcode-select --install


再一次感谢您花费时间阅读这篇文章!

微博: @Danny_吕昌辉
博客: SuperDanny

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值