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. =)
This was very helpful, though the last line of that post needs updating, see below..
ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
LikeLike
This solution seems to be of limited usefulness, as it’s also deleting all the packages that have been installed.
LikeLike
Howdy. Just a small note that the Homebrew installer seems to have moved:
❯ ruby -e “$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)”
Whoops, the Homebrew installer has moved! Please instead run:
ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
Also, please ask wherever you got this link from to update it to the above.
Thanks!
LikeLike
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!!
LikeLike