Question

I installed homebrew today without really knowing what I was doing, and now my scikit-learn package is broken. I want to undo everything that I did by uninstalling homebrew, and tried following the tips here: https://github.com/Homebrew/homebrew/wiki/FAQ

However, I think homebrew installed into /usr/bin/local, and not /usr/bin/, so I'm not sure I can use the instructions in the link.

When I initially installed homebrew (ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"), I got the following messages:

==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1
==> The following directories will be made group writable:
/usr/local/lib/pkgconfig
/usr/local/share/man/man3
/usr/local/share/man/man5
/usr/local/share/man/man7

Can I just delete the files in

/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1

I'm terrified of screwing something up in the uninstallation process. Incidentally, would uninstalling homebrew even restore my system to what it was before? How would I go about doing that?

Was it helpful?

Solution 2

This is covered in the homebrew FAQ:

https://docs.brew.sh/FAQ#how-do-i-uninstall-homebrew

It specifies a script you can run to do it. You should run that script. As of right now, the script says something like:

#!/bin/sh
# Just copy and paste the lines below (all at once, it won't work line by line!)
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY!
 
function abort {
  echo "$1"
  exit 1
}
 
set -e
 
/usr/bin/which -s git || abort "brew install git first!"
test -d /usr/local/.git || abort "brew update first!"
 
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

OTHER TIPS

This worked for me

Official brew uninstalling steps:

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

But /usr/bin/ruby is just symlink in order to find your ruby you need to type

which ruby

Which will give you /snap/bin/ruby

So then just use this :

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

Just run this code in terminal:

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

The is the updated recommended way

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

You may gout output like this:

The following possible Homebrew files were not deleted:
/opt/homebrew/Frameworks/
/opt/homebrew/bin/
/opt/homebrew/etc/
/opt/homebrew/include/
/opt/homebrew/lib/
/opt/homebrew/opt/
/opt/homebrew/sbin/
/opt/homebrew/share/
/opt/homebrew/var/
You may wish to remove them yourself.

To remove run:

sudo rm -rf /opt/homebrew

Clean as a whistle! 😚

Run this in the cli:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top