Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Homebrew install permissions issue

I have a standard homebrew install inside of usr/local/

When I try:

Larson-2:~ larson$ brew install postgresql Error: Cannot write to /usr/local/Cellar 

And when I use sudo:

Larson-2:~ larson$ sudo brew install postgresql Cowardly refusing to `sudo brew install' 

What am I doing wrong?

like image 319
Andrew Lauer Barinov Avatar asked Mar 21 '12 07:03

Andrew Lauer Barinov


2 Answers

You somehow have limited permissions to /usr/local/Cellar. Brew doesn't like to install with sudo which is why it refuses.

Check the permissions:

ls -ld /usr/local/Cellar

Open them up for writing:

sudo chmod a+w /usr/local/Cellar

like image 198
jdi Avatar answered Sep 18 '22 13:09

jdi


Do not use sudo when working with brew (for security reasons).

You've to simple set-up your permissions.

So I would go even further and change the permissions to:

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

and then apply the specific group (either admin or staff) to user which should be allowed to use brew command. Check groups of your user via: id -Gn).

If there are further issues, run: brew doctor to see what's wrong.

like image 34
kenorb Avatar answered Sep 17 '22 13:09

kenorb