reinstall homebrew on osx

I kept getting various homebrew errors while doing brew update.

Error: Failed while executing git pull origin refs/heads/master:refs/remotes/origin/master

error: unable to unlink old ‘bin/brew’ (Permission denied)

brew update fails ‘unable to unlink old ‘.gitignore’

I did a brew doctor, and got tons of warnings and errors. Um… let’s just do a clean re-install… I don’t have time to troubleshoot all that.

If you want to do a clean install, here it is, assuming your brew –prefix is /usr/local.

cd /usr/local
sudo rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
ruby -e "$(curl -fsSL"

Then finally do a brew doctor to take care of minor issues perhaps due to your environment settings.

EDIT (Oct 1st, 2014): changed the old command from ruby -e “$(curl -fsSL” to ruby -e “$(curl -fsSL”. The new command is from Thanks guizm0, Aki, and Henrik. =)

4 thoughts on “reinstall homebrew on osx

  1. Roys says:

    I upgraded to Yosemite and my brew starting giving me errors. The solution provided fixed my problem with a little twist.
    Instead of step 3, I just ran
    brew update
    and homebrew reinstalled the missing files and folder structures. Done!



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s