somnolentsurfer
somnolentsurfer

Reputation: 151

Uninstall Homebrew from /usr/local without affecting /opt/homebrew

Unaware of the problems it would cause, I made the mistake of setting up my 2021 MacBook Pro by restoring from a Time Machine backup. I thought I'd got it all worked out, and have been happily running for a couple of months, but I've just discovered that I still seem to have a Homebrew installation in /usr/local, as well as the default Apple Silicon location of /opt/homebrew, and a bunch of formulae I've installed recently are in the wrong place and linked to the wrong Homebrew installation, and new won't upgrade, failing with the error Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)!

I've removed all the offending formulae and reinstalled them in the right place, but how do I completely remove the /usr/local Homebrew installation without affecting /opt/homebrew? Is the standard uninstall script safe to run?

Upvotes: 4

Views: 2757

Answers (1)

James Risner
James Risner

Reputation: 6076

% sudo /bin/zsh
# arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"

This should only remove the /usr/local homebrew. It reported this in my testing:

==> Homebrew uninstalled!
The following possible Homebrew files were not deleted:
/usr/local/Homebrew/
/usr/local/bin/
/usr/local/etc/
/usr/local/include/
/usr/local/lib/
/usr/local/microsoft/
/usr/local/opt/
/usr/local/sbin/
/usr/local/share/
/usr/local/squid/
/usr/local/var/
You may wish to remove them yourself.

Upvotes: 9

Related Questions