Search code examples
homebrew

Can not uninstall Homebrew


enter image description hereI had an unsafe and incomplete installation of homebrew and now want to completely remove it. When I tried the command given on the official website, the terminal got stuck. I tried to use brew doctor to figure out what the problem was, as shown in the figure. By the way, when installing gaming-porting-toolkits before, I also used the command ""arch -x86_64 zsh"" according to the documentation and then installed brew in the Rosetta environment. . . In short, it is very confusing now. I want to completely delete homebrew but I don’t know how to do it. Please friends give me some guidance.enter image description here

Way to completely delete homebrew, or can I manually delete which files to achieve the same effect


Solution

  • Try the following:

    sudo rm -rf /usr/local/Homebrew/
    sudo rm -rf /opt/homebrew (or wherever you installed HB)
    sudo rm -rf /Library/Caches/Homebrew
    

    If you had added Homebrew's binary path to your shell profile (like .bash_profile, .bashrc, .zshrc, etc.), you'd want to remove it. Typically, it looks like this:

    export PATH="/usr/local/bin:$PATH"
    

    Launch Terminal in Rosetta mode (Applications -> Utilities, find the Terminal app, right-click on it, choose Get Info, and check the box for "Open using Rosetta") Then, open the Terminal and repeat the removal steps.