How to remove Homebrew and clean up your Mac for good

How to remove Homebrew and clean up your Mac for good

It happens to the best of us. You installed Homebrew because some tutorial told you it was the "missing package manager for macOS." You wanted that one specific tool—maybe it was wget, a specialized Python version, or some obscure command-line utility for a weekend project. But now? Your Terminal is spitting out weird errors. Your disk space is dwindling. Honestly, you're just tired of seeing those "Checking for updates" messages every time you try to do something simple. You want it gone.

Deleting the app icon doesn't work here. Homebrew isn't a standard app; it’s a sprawling network of binaries, symlinks, and tucked-away caches that live deep inside your system folders. If you just try to manually delete the /usr/local/bin/brew file, you’re going to leave behind a graveyard of orphaned packages that will haunt your shell path forever.

💡 You might also like: How to Use the Mac OS X Merge Folders Feature Without Losing Your Files

The big "Why" behind getting rid of Homebrew

People usually bail on Homebrew for a few specific reasons. Speed is a huge one. As the cellar grows, things get sluggish. Security is another. Since Homebrew changes permissions on certain system directories to allow for easier installs, some developers prefer to revert to a "vanilla" macOS state to ensure their environment is as secure as Apple intended. Or maybe you're switching to Nix or MacPorts.

Whatever the reason, you've got to be surgical. If you mess this up, you might break other developer tools that rely on the paths Homebrew modified.

Running the official uninstaller script

Apple doesn't provide a "Remove Homebrew" button. You have to use the official Ruby script provided by the Homebrew team themselves. This is the safest way to do it because it’s programmed to find the specific directories based on whether you're on an Intel Mac or a newer Apple Silicon (M1/M2/M3) chip.

Open your Terminal. Copy and paste this command:

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

👉 See also: Why Juno Probe Images of Jupiter Changed Everything We Knew About the Giant

Don't just hit enter and walk away. The script is going to ask for your sudo password. Type it in. You won't see asterisks or dots while you type—that’s just how Terminal works. Once you hit enter, it’ll give you a scary-looking list of everything it’s about to nukes. Read it. If you're okay with it, confirm by typing y.

The Architecture Divide

Where Homebrew lives depends entirely on your hardware.
On Intel Macs, you'll find everything in /usr/local.
On Apple Silicon Macs, the party is over at /opt/homebrew.

The uninstaller is usually smart enough to know where it is, but if you've migrated data from an old Mac to a new one using Migration Assistant, you might actually have two versions of Homebrew installed. One in each location. In that case, you’ll need to run the uninstaller specifically for each path using the --path flag, or just manually scrub the leftover directory.

Scrubbing the leftovers (The Manual Part)

Even after the "official" script finishes, it often leaves crumbs. It’s annoying. It’s like moving out of an apartment but forgetting the stuff in the back of the pantry. You need to check for these specific folders and delete them if they still exist:

📖 Related: What Does TLDR Mean? Why the Internet's Favorite Acronym is Changing How We Read

  1. /usr/local/Homebrew
  2. /Library/Caches/Homebrew
  3. /usr/local/var/homebrew

You can kill these with a simple rm -rf command, but be careful. Using rm -rf is like using a flamethrower. One typo and you’ve deleted your entire Documents folder. Double-check your syntax.

Cleaning your Shell Profile

This is the part most people forget. Even if the files are gone, your shell (probably Zsh or Bash) is still looking for them. Every time you open a Terminal window, it’s searching for a Homebrew ghost.

You need to edit your .zshrc or .bash_profile.
Use a text editor like Nano: nano ~/.zshrc.
Look for any lines that mention eval "$(/opt/homebrew/bin/brew shellenv)" or paths that include /usr/local/bin.
Delete those lines.
Hit Ctrl + O to save and Ctrl + X to exit.

If you don't do this, you’ll keep getting "command not found: brew" errors every time you start a session. It's not a dealbreaker, but it's definitely a nuisance that makes your system feel "broken."

Xcode Command Line Tools: To keep or not to keep?

Homebrew requires the Xcode Command Line Tools to function. When you remove Homebrew, these tools stay behind.

Do you need them? If you’re a developer who uses Git, or if you ever compile code from source, keep them. They are official Apple tools and don't take up an offensive amount of space. However, if you're trying to go back to a completely "clean" slate, you can remove them by deleting the /Library/Developer/CommandLineTools folder.

Just a heads up: the next time you try to run a command like git in the terminal, macOS will pop up a window asking you to reinstall them. It’s a bit of a cycle.

Common pitfalls and "permission denied" errors

Sometimes, the uninstaller fails because of permissions. macOS is very protective of the /usr/local directory. If you get a "Permission Denied" error during the process, it usually means some files were created by a different user or a process is currently using them.

Rebooting your Mac before running the uninstaller can help clear out any active processes. If that fails, you might have to manually change the ownership of the folder back to yourself using chown. It sounds technical, but basically, you're telling the computer, "I own this folder, let me delete it."

What to do instead of Homebrew

Maybe you didn't hate the idea of a package manager, you just hated Homebrew.

MacPorts is the old-school alternative. It’s been around forever and some people find it more stable because it doesn't mess with /usr/local permissions the same way Homebrew does. It installs everything into /opt/local.

Nix is the new cool kid on the block. It's functional, meaning it’s almost impossible to "break" your system with it because every package is isolated. But be warned: the learning curve for Nix is a vertical cliff.

If you just needed one specific app, check if there's a .dmg or a .pkg installer on the developer's website. Sometimes we overcomplicate things with command-line tools when a simple download button would have sufficed.


Actionable Next Steps

  1. Backup your data. Before running any script that executes with sudo and deletes directories, ensure your Time Machine backup is current.
  2. Identify your architecture. Click the Apple icon > About This Mac to see if you have an Intel or Apple chip. This dictates where you should look for leftover files.
  3. Run the uninstaller. Use the official Ruby script mentioned above.
  4. Clean the PATH. Open ~/.zshrc and remove the Homebrew initialization lines to stop the "command not found" ghosts.
  5. Verify. Type which brew into your terminal. If it returns nothing, you’ve successfully reclaimed your system.