The Computer Oracle

Homebrew won't link git

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Dreamlands

--

Chapters
00:00 Homebrew Won'T Link Git
00:38 Accepted Answer Score 5
01:45 Answer 2 Score 0
02:03 Thank you

--

Full question
https://superuser.com/questions/397704/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#macos #permissions #git #homebrew

#avk47



ACCEPTED ANSWER

Score 5


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



ANSWER 2

Score 0


I haven't tried the gist yet, but tried to chmod 775 on the folder. As it owned by root:wheel it cannot be changed. I referenced a Japanese site.

sudo chown yourusername:admin -R /usr/local/share/ghostscript
brew link ghostscript
brew doctor

then it works for me above.