Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Cowardly refusing to `sudo brew install` for installing glue 0.3 for Mac OSX Mountain Lion

Tags:

homebrew

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!

like image 600
s1mcity Avatar asked Sep 26 '13 21:09

s1mcity


4 Answers

sudo chown root /usr/local/bin/brew
like image 191
Sagar Avatar answered Nov 20 '22 13:11

Sagar


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

like image 32
Neo Avatar answered Nov 20 '22 13:11

Neo


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
like image 8
jetlej Avatar answered Nov 20 '22 12:11

jetlej


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 from step 1]

like image 5
Sverrisson Avatar answered Nov 20 '22 13:11

Sverrisson