macOS sierra brew权限问题

发布于 2022-09-04 00:46:00 字数 1283 浏览 13 评论 0

我升级系统到macOS sierra 后,用如下命令更新了homebrew

cd "$(brew —repo)" && git fetch && git reset —hard origin/master && brew update

遇到错误:

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

按照提示设置了,成功执行了brew update

然后在升级go的时候又遇到权限问题了,描述如下

Error: Running Homebrew as root is extremely dangerous. As Homebrew does not
drop privileges on installation you are giving all build scripts full access
to your system. As a result of the macOS sandbox not handling the root user
correctly HOMEBREW_NO_SANDBOX has been set so the sandbox will not be used. If
we have not merged a pull request to add privilege dropping by November 1st
2016 running Homebrew as root will be disabled. No Homebrew maintainers plan
to work on this functionality.
Error: Cowardly refusing to 'sudo brew install'
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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

与君绝 2022-09-11 00:46:00

用Mac作开发都应该打开root权限,不然很多文件无法修改

开机按
Command + R 启动, 进入终端
输入:
csrutil disable

重启

如果没有Recovery分区,会自动下载恢复工具,但网络真心慢,耐心等吧

任何一人系统安装盘,安装前也可进入终端的。

该命令只能在Recovery模式下有权限,我试过 Command + S启动,没权限执行

对了,这特性好像10.9后有的,之前的不用

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文