homebrew 无法安装提示不能在根目录下使用

来源:互联网 发布:若风淘宝店网址多少 编辑:程序博客网 时间:2024/05/21 19:46

本文来源http://www.cnblogs.com/xiaohaillong/p/6120913.html

homebrew 无法安装,提示不能在根目录下使用。

Running Homebrew as root is extremely dangerous and no longer supported.As Homebrew does not drop privileges on installation you would be giving allbuild scripts full access to your system.

解决思路就是给当前用户添加目录权限:

sudo chown -R $(whoami) /usr/local

然后再安装你需要的软件通过:brew install softname;

不过,如果还是遇到不能安装的情况,就根据提示内容再次给当前用户赋予相应的目录权限(这里系统会提示),你只要根据提示操作就行了。

在我执行上面的命令之后,我想安装软件:

又提示了一下错误:

Error: /usr/local/Cellar is not writable. You should change theownership and permissions of /usr/local/Cellar back to youruser account:  sudo chown -R $(whoami) /usr/local/CellarError: Cannot write to /usr/local/Cellar

我根据提示再次执行命令:

sudo chown -R $(whoami) /usr/local/Cellar

然后,再次安装我需要的软件,问题解决了。

如果后面还有错误提示,就再次根据提示操作。直到问题解决。

有需要的可以试试
原创粉丝点击