2

I'm am getting an error message when I try to link git.

Linking /usr/local/Cellar/git/1.8.5.3... Warning: Could not link git. Unlinking... Error: Could not symlink file: /usr/local/Cellar/git/1.8.5.3/share/git-core/templates/info/exclude /usr/local/share/git-core/templates/info is not writable. You should change its permissions.

All of this started after I (stupidly) installed the command line tools inside the GitHub for Mac GUI. I checked the permissions of the folder that it is telling me about, giving it 777 permissions. This hasn't helped, so can anyone either help me remove the GitHub versions or help me figure out a way to fix this mess.

1
  • Yes, thank you. I just did and that solved my issues.
    – UprightCitizen
    Jan 25, 2014 at 5:36

3 Answers 3

1

Remove the directory /usr/local/share/git-core and try again, do be aware, though, this might break GitHub...

3
1

Running:

sudo chown -R :admin /usr/local
sudo find /usr/local/ -perm -200 -exec chmod g+w '{}' \+

will ensure that everything under /usr/local has a group of admin (of which every OS X admin user belongs to), and that any file with user-write permissions is also given group write permissions.

You may still need to run brew link --overwrite git instead of brew link git, but try without the --overwrite first and Homebrew will tell you if it needs the flag.

1

Maybe you use sudo to install some application before ,So the owner of dictionay /usr/local/share/ and /usr/local/lib become root

run:

sudo chown -R $(whoami) /usr/local/share/

sudo chown -R $(whoami) /usr/local/lib

and then run:

brew link git
1
  • Thank you for this answer, it worked for me. Not only that, it's a nice non-destructive and general tip for cleaning up the brew environment!
    – Cory
    Dec 28, 2016 at 20:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .