今天想使用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