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

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

Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build 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 the
ownership and permissions of /usr/local/Cellar back to your
user account:
  sudo chown -R $(whoami) /usr/local/Cellar
Error: Cannot write to /usr/local/Cellar

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

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

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

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

猜你喜欢

转载自blog.csdn.net/onlyliii/article/details/79973813
今日推荐