cd `brew –prefix`
brew prune
rm `git ls-files`
rm -r /usr/local/Homebrew
rm -rf .git
rm -rf ~/Library/Caches/Homebrew
rm -rf /usr/local/opt
rm -rf /usr/local/Caskroom
rm -rf /usr/local/var/homebrew

如果提示没有权限,需要在rm命令前加上sudo

出处链接:https://simnovo.net/uninstall-homebrew-in-macos-sierra-10-12/