How do I update Homebrew?

GitHomebrew

Git Problem Overview


When I ran:

brew update

I got a message saying it initialized an empty repository in /usr/local/.git/, then I got this error:

Screenshot

Git Solutions


Solution 1 - Git

  • cd /usr/local
  • git status
  • Discard all the changes (unless you actually want to try to commit to Homebrew - you probably don't)
  • git status til it's clean
  • brew update

Solution 2 - Git

As of 2021 you can simply use brew update which updates homebrew itself.

Solution 3 - Git

Alternatively you could update brew by installing it again. (Think I did this as El Capitan changed something)

Note: this is a heavy handed approach that will remove all applications installed via brew!

Try to install brew a fresh and it will tell how to uninstall.

At original time of writing to uninstall:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

Edit: As of 2020 to uninstall:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionandrewpthorpView Question on Stackoverflow
Solution 1 - GitcorysimmonsView Answer on Stackoverflow
Solution 2 - GitnzoLogicView Answer on Stackoverflow
Solution 3 - GitPeter O'BrienView Answer on Stackoverflow