How to uninstall Homebrew?

Homebrew once recommended a script, also linked in their FAQ. Instructions have changed since then, and they provide an official uninstall script you can download and run:

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

Here is a copy of the old script, for historical purposes:

cd `brew --prefix`
git checkout master
git ls-files -z | pbcopy
rm -rf Cellar
bin/brew prune
pbpaste | xargs -0 rm
rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions 
test -d Library/LinkedKegs && rm -r Library/LinkedKegs
rmdir -p bin Library share/man/man1 2> /dev/null
rm -rf .git
rm -rf ~/Library/Caches/Homebrew
rm -rf ~/Library/Logs/Homebrew
rm -rf /Library/Caches/Homebrew

This should also revert your /usr/local folder to its pre-Homebrew days. See the Homebrew installation wiki for more information.

Note: You may also need to remove ~/.homebrew as well. If you happen to have ~/.rvm, then you should delete ~/.rvm/bin/brew.


Homebrew provides an uninstall script located here.

Just run the following in the OSX terminal:

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

Also note that homebrew changes group to 'staff' and gives write access to group for

  • /usr/local
  • /usr/local/bin
  • /usr/local/include
  • /usr/local/lib
  • /usr/local/sbin
  • /usr/local/share

In order to put back these directories in their original states do:

sudo chown root:wheel <directory> ; sudo chmod 755 <directory>

for each one or if you don't have fancy owners / rights:

sudo chown -R root:wheel /usr/local ; sudo chmod -R 755 /usr/local

Tags:

Macos