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 https://raw.githubusercontent.com/Homebrew/install/master/install)"

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 https://raw.github.com/Homebrew/homebrew/go/install)” to ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”. The new command is from http://brew.sh/. 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!

    Thanks!!

    Like

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s