Tried to update git
on my Mac system (High Sierra 10.13.3) using
brew install git
which gives the output
$ brew install git
==> Downloading https://homebrew.bintray.com/bottles/git-2.16.2.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring git-2.16.2.high_sierra.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/man/man5/gitattributes.5
/usr/local/share/man/man5 is not writable.
You can try again using:
brew link git
==> Caveats
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
zsh completions and functions have been installed to:
/usr/local/share/zsh/site-functions
Emacs Lisp files have been installed to:
/usr/local/share/emacs/site-lisp/git
==> Summary
🍺 /usr/local/Cellar/git/2.16.2: 1,496 files, 34.5MB
However, you can see that it has a problem with the brew link
step. Attempting to fix it by running
brew link git
brew link --overwrite git
brew link --force git
gives the same error
Linking /usr/local/Cellar/git/2.16.2...
Error: Could not symlink share/man/man5/gitattributes.5
/usr/local/share/man/man5 is not writable.
Anyone experienced this too and managed to fix it?
Mac's Users and Group
Output
You have to fix the permissions with:
sudo chown -R "$USER":admin /usr/local
sudo chown -R "$USER":admin /Library/Caches/Homebrew
It works well, if you are the only homebrew user on the system. It could cause problems if third party tools are waiting other permissions on /usr/local
. But, I use this settings for years without problems. See How to fix homebrew permissions? for details.
But for this you must have the right to administer the computer. In System Preferences -> Users & Groups, your user should have the checkbox "Allow user to administer this computer" checked.
If you are on High Sierra, the /usr/local
is not writable (probably due to changes in SIP) but the contents are. So you just need to modify the commands from the other answer to only target the directories within:
sudo chown -R "$USER":admin /usr/local/*
sudo chown -R "$USER":admin /Library/Caches/Homebrew/*
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With