Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When I installed git or upgrade git via brew I couldn't link it with brew link git. If I try sudo brew link git I get:

cowardly refusing to sudo brew link

It says that I have to check the permissions on:

/usr/local/share/gitk/lib
/usr/local/share/git-gui/lib
/usr/local/share/git-core/templates
/usr/local/share/git-core/templates/hooks
/usr/local/share/git-core

I chmoded everything to 777 but I'm not sure if it is good.

I can now link git. Should I change the permission to something less permissive?

share|improve this question

1 Answer

up vote 4 down vote accepted

777 permissions aren't necessarily bad here – you'll probably never run into permissions problems, and it's not a huge security issue I'd say.

Anyway, the "normal" permissions on /usr/local/share that Homebrew requires should be (recursively) 755, thus rwxr-xr-x.

chmod -R 755 /usr/local/share

At least brew shouldn't need sudo permissions to ever do anything in there. Only /usr/local is owned by root, but writable for the staff group, in which your user should be in.

For fixing existing Homebrew installations, check out this gist, which is a script that will attempt to correct your /usr/local permissions.


As an example, here's the directory listing of one of my (sane) Homebrew installations with ghostscript being the only exception that needed a sudo brew link:

aeneas:local werner$ ls -la /usr/local/share/
total 40
drwxr-xr-x  11 werner  staff  374 Mar  5 14:53 .
drwxrwxr-x  14 werner  staff  476 Feb 28 12:51 ..
drwxr-xr-x   6 werner  staff  204 Mar  5 14:54 aclocal
drwxr-xr-x   8 werner  staff  272 Mar  5 14:53 doc
lrwxr-xr-x   1 werner  staff   34 Feb  8 12:26 ffmpeg -> ../Cellar/ffmpeg/0.10/share/ffmpeg
drwxr-xr-x   4 werner  wheel  136 Apr 16  2010 ghostscript
lrwxr-xr-x   1 werner  staff   36 Mar  5 14:53 git-core -> ../Cellar/git/1.7.9.2/share/git-core
lrwxr-xr-x   1 werner  staff   35 Mar  5 14:53 git-gui -> ../Cellar/git/1.7.9.2/share/git-gui
lrwxr-xr-x   1 werner  staff   32 Mar  5 14:53 gitk -> ../Cellar/git/1.7.9.2/share/gitk
lrwxr-xr-x   1 werner  staff   34 Mar  5 14:53 gitweb -> ../Cellar/git/1.7.9.2/share/gitweb
drwxr-xr-x   9 werner  staff  306 Mar  5 14:53 man
share|improve this answer
For more diagnosing steps, run brew doctor. – slhck Mar 6 '12 at 22:50
Unfortunately, brew doctor does not give any useful information in this case. The mentioned gist fixed a similar problem for me, thanks :) – TheDeadSerious Jun 6 '12 at 13:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.