Error: Cowardly refusing to `sudo brew install` fo

2019-03-08 03:25发布

I'm trying to install glue 0.3 for OXS Mountain Lion and ran into this error after installing homebrew (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.) I got this error after the first step for installing glue 0.3 ($ sudo brew install jpeg). No idea how to fix this...please help!

标签: homebrew
6条回答
不美不萌又怎样
2楼-- · 2019-03-08 04:02

I have updated my macos to sierra and npm stopped working. Below are the steps followed to fix them.

Uninstall Node and install it from brew and follow the below steps

➜ ~ sudo chmod g+w /usr/local/Cellar

➜ ~ sudo chgrp staff /usr/local/Cellar

➜ ~ sudo chown root /usr/local/bin/brew

➜ ~ sudo brew postinstall node

查看更多
唯我独甜
3楼-- · 2019-03-08 04:03
sudo chown -R $USER /usr/local

Use the above command instead of changing the owner of brew to root.

This is the suggested method by the Owner of homebrew in https://github.com/Homebrew/homebrew/issues/9953

查看更多
劳资没心,怎么记你
4楼-- · 2019-03-08 04:04

Answered by the developers here:

https://github.com/Homebrew/homebrew/issues/9953

I solved it by NOT using sudo, and changing the permissions on whatever file it says cannot be accessed without sudo.

For example, I could not access /usr/local/Cellar, so I entered the following (as specified here: https://github.com/Homebrew/homebrew/issues/3930)

sudo chmod g+w /usr/local/Cellar
sudo chgrp staff /usr/local/Cellar
查看更多
家丑人穷心不美
5楼-- · 2019-03-08 04:21

This was helpful for me http://digitizor.com/fix-cowardly-refusing-sudo-error-brew/

As quoted in the text, you essentially have to change the user and group of brew to root and wheel respectively.

查看更多
smile是对你的礼貌
6楼-- · 2019-03-08 04:23

For High Sierra macOS 10.13.3 or newer.

None of the solutions given here worked for me on this version. The only (and the best) fix is to uninstall brew and install it again with the following terminal commands. Note you will lose your current kegs, so you should get a list of the installed kegs, for reinstalling them after reinstalling brew as shown below under step 1. Actually, this was a good opportunity for me to get rid of those kegs that I am no longer using:

1) List your current kegs for reinstalling, those you wan't to keep:

brew list

2) Uninstall brew:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

3) Reinstall brew:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

4) Optionally to prevent your usage being sent to Google Analytics (Update: Fortunately, now this has been stopped, so you may skip this step):

brew analytics off

5) Finally reinstall your previous kegs from step 1 (or those you still want to use). Replace the text with the square brackets with the list, (i.e. brew install sqlite heroku ):

brew install [list of kegs in step 1]
查看更多
一纸荒年 Trace。
7楼-- · 2019-03-08 04:26

sudo chown root /usr/local/bin/brew

查看更多
登录 后发表回答