14

I am trying to fix some brew doctor error but now after manually erased some files that brew doctor suggested I get the following error when trying to do a brew update :

error: cannot open .git/FETCH_HEAD: Permission denied

Error: Failed to update tap: homebrew/versions
Already up-to-date.
3
  • use sudo for the update? Sep 10, 2014 at 16:26
  • 1
    What are the permissions on /usr/local/.git? Sounds like you're perhaps sharing a machine and someone else updated homebrew and, in the course of doing that, took ownership of the /usr/local directory tree.
    – Ian C.
    Sep 10, 2014 at 16:45
  • No the macbook pro is mine.I am not sharing with anybody else.The permissions of /usr/local/.git are Administrator staff
    – skiabox
    Sep 10, 2014 at 17:47

3 Answers 3

27

If you are using OSX High Sierra chown operation is not permitted in /usr/local/ in this case use:

sudo chown -R $(whoami) /usr/local/Homebrew/
1
13

I managed to fix this error by fixing the user owner of the /usr/local folder from 504 to Administrator (the user id I am using when I log in to macbook pro terminal).

This was achieved by using this command :

sudo chown -R $USER:admin /usr/local
1
  • I had to run sudo chown -R $(whoami):admin /usr/local on Catalina Jun 18, 2020 at 14:16
1
sudo chown -R $(whoami):admin /usr/local && sudo chmod -R g+rwx /usr/local
0

You must log in to answer this question.

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