I'm Getting Errors When I Try to do 'brew update'
Solution 1:
I've similar problems and my research suggests resetting your local version of the brew repo:
cd $(brew --prefix) && git fetch && git reset --hard origin/master
I'm about to try this myself.
Solution 2:
As mentioned here: https://github.com/Homebrew/legacy-homebrew/issues/49879#issuecomment-196294820
What worked for me given all the errors was
sudo chown -R $(whoami):admin /usr/local
cd $(brew --prefix) && git fetch origin && git reset --hard origin/master
Then I could run brew commands again, such as brew update
and brew upgrade
. (And fwiw, as an alternative to brew list
if it weren't working and you just wanted a quick list, you can get a crude listing just by doing ls -l cd $(brew --prefix)/Cellar
)
Solution 3:
Building off of the previous answer, run the following:
sudo chown $(whoami):admin /usr/local
cd $(brew --prefix) && git fetch origin && git reset --hard origin/master
brew update
I just ran that on El Capitan 10.11.6, and the update ended with the message:
==> Migrating HOMEBREW_REPOSITORY (please wait)...
==> Migrated HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Homebrew no longer needs to have ownership of /usr/local. If you wish you can
return /usr/local to its default ownership with:
sudo chown root:wheel /usr/local
If you see that, run the command to correctly return the permission change you made at the beginning to normal.