brew 安装软件出出现/usr/local目录权限不免够

现象:

JazzdeMacBook-Air:~ jazzli$  brew update

Error: /usr/local must be writable!

JazzdeMacBook-Air:~ jazzli$ sudo  brew update

Error: Cowardly refusing to 'sudo brew update'

You can use brew with sudo, but only if the brew executable is owned by root.

However, this is both not recommended and completely unsupported so do so at

your own risk.

发现是El Capitan(10.11) 加入了Rootless机制,很多系统目录不再能够随心所欲的读写了,即使设置 root 权限也不行。

以下路径无法写和执行

/System
/bin
/sbin
/usr (except /usr/local)

 

加入这个机制主要是为了防止恶意程序的入侵,更多我们可以查看官网

https://developer.apple.com/videos/play/wwdc2015/706/

解决方法:

如何关闭

重启按住 Command+R,进入恢复模式,打开Terminal

csrutil disable

 

如何开启

重启按住 Command+R,进入恢复模式,打开Terminal。

csrutil enable

 

posted @ 2018-02-03 23:08  \牛魔王/  阅读(461)  评论(0)    收藏  举报