[ACCEPTED]-Installing in Homebrew errors-homebrew

Accepted answer
Score: 275

sudo chown -R $USER /usr/local

You'll have to give yourself ownership of 16 /usr/local/ using that line right there. I had to do 15 this myself after using the ruby one-liner 14 at the top of the official docs to install 13 Homebrew. Worked like a charm for me. It 12 ought to be the only time you'll ever need 11 to sudo with Homebrew.

I'm not sure if the ruby 10 one-liner does this. If it did, then something 9 else on my system took control of /usr/local since.

Edit: I 8 completely missed this, but @samvermette didn't (see 7 replies to my answer): if you run this command 6 above and have something installed via homebrew 5 that requires special user permissions, like 4 mysql, make sure to give those permissions back 3 (as the above command gives recursive ownership 2 to everything inside /usr/local to you ($USER). In the 1 case of mysql, it's…

sudo chown -RL mysql:mysql /usr/local/mysql/data

Score: 41

I had this issue after upgrading to Mavericks, and 11 this page was the top search result when 10 googling the error message. I continued 9 searching and found this answer on stack overflow.com. Put concisely, it 8 is:

sudo chmod a+w /usr/local/Cellar

This fixed the issue for me, and as it 7 only changes permissions for the specific 6 path referenced in the error message, seemed 5 unlikely to have negative side effects with 4 other installations.

I'm putting this answer 3 here for anyone else who may find this page 2 first like I did. However, credit should 1 go to jdi.

Score: 11

You can allow only Admin users writing into 2 /usr/local/?

chgrp -R admin /usr/local
chmod -R g+w /usr/local
chgrp -R admin /Library/Caches/Homebrew
chmod -R g+w /Library/Caches/Homebrew

Since that each user who belongs to Admin 1 group, will be able to install new dependencies.

Score: 5

On High Sierra you need the following command 2 cause chown will not work:

sudo chown -R 1 $(whoami) $(brew --prefix)/*

Link:

https://github.com/Homebrew/brew/issues/3228

Score: 2

uninstall and re install HomeBrew that will 1 do the trick

Score: 1

I suggest ensuring that the current user 11 is a member of the group that owns /usr/local. I 10 believe by default, that group is wheel. To make 9 yourself a member of that group:

$ sudo dscl . append /Groups/wheel GroupMembership $USER

Although 8 something of an inelegant hammer, it has 7 the intended effect - enabling access to 6 items in /usr/local that are intended only for use 5 (read/write) by elevated members. This approach 4 has benefits of the other above because 3 it takes advantage of the group memberships, enabling 2 multiple (authorized) users on the system 1 to use homebrew.

Score: 0

How did you install Homebrew? Their official installation instructions include 7 running a ruby script. That should take 6 care of the permission issues for you.

If 5 you don't want to run a script, there is 4 a section of that page called "Installing 3 to /usr/local for Developers" that 2 explains the change in permissions needed 1 for the /usr/local directory.

More Related questions