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.
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.
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)"
>> git clone https://github.com/Homebrew/brew ~/git/brew, then run it from there - all packages will be residing there then.
– Red Pill
Oct 09 '20 at 17:05
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
– Stack Overflown
Nov 14 '20 at 16:11
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/shareIn 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
/usr/local and its Homebrew-created subdirs are owned by my user with the admin group.
– slhck
Dec 26 '12 at 16:21
Try this gist, it uninstalls homebrew and associated caches, provided you installed brew to the default directory.
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)"
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.
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.
Desktop,Documentsand 'Downloads`. It messed up my git too. Please help! – Ava Aug 16 '13 at 22:53/Users/$username/Library/LaunchAgents
– itinance Apr 27 '14 at 08:02/usr/local/Library/. Wtf? It contains other files too, like MySQL stuff. It seems that homebrew was installed directly to/user/local/. WTF?!? – StanE Sep 06 '16 at 00:25