I’ve got some problems with the package manager, Homebrew. I can’t find how to remove it!

Is it safe to remove whole /usr/local? Homebrew was installed somewhere in that directory.

7 Answers 7


They provide an official uninstall script you can download and run:

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

Homebrew once recommended an older script, also linked in their FAQ.

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. If any of your brew package had brew services that are running, you should turn them off. If any packages installed their own libraries (like Python's pip) you'll have to uninstall those manually.

  • thank you so much! i've googled so hard, but even't bothered to look for uninstallation actions in installation manual! ;D
    – holms
    Oct 28, 2010 at 15:36
  • 15
    Note that the instructions have changed over time, and also been moved to the Homebrew FAQ github.com/mxcl/homebrew/wiki/FAQ/…
    – Nelson
    Sep 10, 2011 at 23:19
  • Following these commands deleted almost all my files on Desktop, Documents and 'Downloads`. It messed up my git too. Please help!
    – Ava
    Aug 16, 2013 at 22:53
  • rm -rf Library/Taps
    – Googol
    Mar 13, 2014 at 13:25
  • 3
    If the first line of this script fails it will try to delete whatever is in your pasteboard. That could be a lot of your data.
    – ade
    Jan 16, 2016 at 23:05

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)"
  • 3
    good one, just simple solution
    Mar 6, 2016 at 4:20
  • 1
    Better imho is to install homebrew cleanly in the first place. Here is how: >> git clone https://github.com/Homebrew/brew ~/git/brew, then run it from there - all packages will be residing there then.
    – Red Pill
    Oct 9, 2020 at 17:05
  • 4
    The Ruby uninstaller has been deprecated; they now recommend use of this Bash command: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)" Nov 14, 2020 at 16:11
  • Thanks @StackOverflown, I just updated the broken link and uninstall command. Feb 2, 2021 at 17:59
  • After running this command, I got below output ==> Homebrew uninstalled! The following possible Homebrew files were not deleted: /usr/local/.com.apple.installer.keep /usr/local/Frameworks/ /usr/local/Homebrew/ /usr/local/bin/ /usr/local/etc/ /usr/local/include/ /usr/local/lib/ /usr/local/opt/ /usr/local/share/ /usr/local/var/ You may wish to remove them yourself.
    – vikramvi
    Mar 13, 2021 at 10:49

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
  • 1
    I cannot confirm this. My /usr/local and its Homebrew-created subdirs are owned by my user with the admin group.
    – slhck
    Dec 26, 2012 at 16:21

Try this gist, it uninstalls homebrew and associated caches, provided you installed brew to the default directory.

  • how do you use a gist?
    – ninja08
    Feb 13, 2015 at 21:36
  • @ninja08 Click on the link. Open a terminal window. Copy all of the gist's text into the terminal.
    – Spotlight
    Aug 10, 2015 at 21:13

I recently made a script to handle this case. It completely removes Homebrew, and has CLI options like silent/verbose and force modes, as well as mode that returns the location of your Homebrew installation.


The ruby script now prints:

Warning: The Ruby Homebrew uninstaller is now deprecated and has been rewritten in
Bash. Please migrate to the following command:
  /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"

So the right way to uninstall is apparently to run:

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

There might be other files in /usr/local you might need you might be able to user a different PM (Package Manager) to remove the current PM.

  • 1
    I'm unclear as to what this answer means. What's a PM? May 16, 2013 at 4:00
  • PM = Package Manager
    – Stephen
    Sep 16, 2014 at 17:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .