homebrew 无法安装,提示不能在根目录下使用
最近在新Mac下面安装node,没想到遇到这个问题,Mac版本是10.12。
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的版本,和我之前的Mac不太一样。
如下
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
提示你不要在root权限下使用brew,那你就不要加sudo了
把
/use/local
的owner換成自己,就有write權限了whoami
就是一個命令,會echo當前登錄用戶的名字。當然你知道自己的用戶名,比如jack,就直接也可以
修改過權限之後,就直接跑
不需要再用sudo,因為當前用戶已經有權限寫入/usr/local了
或者你用
確認一下這個目錄的owner是否已改到自己
遇到同一个问题,新买的MacBook pro,安装失败
error: RPC failed; curl 56 SSLRead() return error -9806/s
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Error: Failure while executing: git clone https://github.com/Homebrew/h... /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
Error: Failure while executing: /usr/local/bin/brew tap homebrew/core
Failed during: /usr/local/bin/brew update --force
也是mac,做了以下操作就可以啦。
Error: 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.
➜ ~ brew install Graphviz
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
fatal: could not create leading directories of '/usr/local/Library/Taps/homebrew/homebrew-core': Permission denied
Error: Failure while executing: git clone https://github.com/Homebrew/h... /usr/local/Library/Taps/homebrew/homebrew-core --depth=1 -q
Error: Failure while executing: /usr/local/bin/brew tap homebrew/core -q
➜ ~ sudo mkdir -p /usr/local/Library/Taps/homebrew/homebrew-core
➜ ~ brew install Graphviz
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
Error: No available formula with the name "graphviz"
sudo -i 你可以试试先开启超级权限,然后直接安装看看行不行就不要加sudo了
Could not symlink include/node
/usr/local/include is not writable.
我这里提示这个不能写,我直接用finder去文件夹里面创建了。
直接去改/opt/homebrew/Library/Homebrew里的brew.sh文件。(你也有可能在其他位置,自己找一找)
在 check-run-command-as-root() 方法里面直接return掉。
原理是他在这个方法判断id是否为0(root的id为0),来知道你是否是root执行的。
直接return掉就一切OK了,虽然不优雅,但有效。
sudo chown -R $(whoami) /usr/local
报错的同时,也给你了解决方案