I'm using Homebrew to manage package installs on Lion (Lion Server actually but this shouldn't matter).
Homebrew was installed under one user. Now a different user would like to add a package and Homebrew isn't happy:
$ brew update
fatal: Unable to create '/usr/local/.git/index.lock': Permission denied
Error: Failure while executing: git checkout -q master
Is this considered bad? I thought one of the advantages of using /usr/local/ for your installs was that you don't need sudo. But clearly we do.
All users who would need to modify Homebrew are members of admin group. So, I could chmod -R g+w /usr/local/ but afraid this will bork something or create security issues?!?
Advice?
$ ls -al /usr/local/.git/
total 432
drwxr-xr-x 14 ladmin admin 476 Feb 24 11:48 .
drwxrwxr-x 14 root admin 476 Feb 9 15:27 ..
-rw-r--r-- 1 ladmin admin 94 Feb 24 11:48 FETCH_HEAD
-rw-r--r-- 1 ladmin admin 23 Feb 24 11:48 HEAD
-rw-r--r-- 1 ladmin admin 41 Feb 9 15:28 ORIG_HEAD
drwxr-xr-x 2 ladmin admin 68 Feb 9 15:27 branches
-rw-r--r-- 1 ladmin admin 218 Feb 9 15:27 config
-rw-r--r-- 1 ladmin admin 73 Feb 9 15:27 description
drwxr-xr-x 12 ladmin admin 408 Feb 9 15:27 hooks
-rw-r--r-- 1 ladmin admin 200272 Feb 24 11:48 index
drwxr-xr-x 3 ladmin admin 102 Feb 9 15:27 info
drwxr-xr-x 4 ladmin admin 136 Feb 9 15:27 logs
drwxr-xr-x 4 ladmin admin 136 Feb 9 15:27 objects
drwxr-xr-x 5 ladmin admin 170 Feb 9 15:27 refs
brew doctorstill complains that e.g./usr/local/includeis not writable even though I manually can verify that I can write to a file here (e.g. usingecho "hello" > /usr/local/include/testfile). I am member of the admin group. Any ideas for debugging? – mgd Jun 22 '12 at 21:40chmod -R g+w /Library/Caches/Homebrew– Drew Dara-Abrams May 08 '13 at 15:57sudo chown -R $(whoami) $(brew --prefix)/*instead of the commands above. Got it from here – Jeff Kranenburg Jan 27 '18 at 07:04g+wpersmission by default? Do I need to run these commands over and over again? – cubuspl42 Nov 07 '19 at 11:38