How to Remove Homebrew from Your Mac
A few months ago, I moved my web design and programming jobs from a Linux environment to macOS running on my Mac Studio. During that time, I installed several developer tools and utilities on macOS using Homebrew to facilitate my workflow.
Recently, I decided to keep my Mac Studio pristine and maintain a streamlined setup. To achieve this, I transitioned most of my programming and web design activities to a PC running GhostBSD XFCE, a lightweight, user-friendly FreeBSD-based operating system known for its simplicity, reliability, and efficiency in desktop environments. This allowed me to offload the coding workload and avoid duplicating software environments unnecessarily.
As I no longer needed the programming setup on my Mac Studio, I decided to remove everything installed by Homebrew, including Homebrew itself, to clean up and free space.
Steps to Remove Homebrew and All Installed Packages
- List Installed Packages
I began by listing all the formulae (command line tools, libraries) installed with Homebrew:- gcc, php, python@3.13
- gettext, openssl@3
- curl, sqlite, readline
- image/video libraries like jpeg-turbo, giflib, openexr
- networking and security tools such as unbound, gnupg
- various other supporting libraries
- Uninstalling All Formulae
I ran the command to uninstall all installed formulae in bulk:brew uninstall --force $(brew list --formula)
- Running the Official Homebrew Uninstall Script
Next, I executed Homebrew’s official uninstall script to remove the core Homebrew system and files:/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
- Cleaning Up Leftover Files
There were some residual Homebrew directories, like/opt/homebrew/.git,/opt/homebrew/etc,/opt/homebrew/share, and/opt/homebrew/varwhich I removed manually:sudo rm -rf /opt/homebrew/.git /opt/homebrew/etc /opt/homebrew/share /opt/homebrew/var
- Removing Homebrew PATH Configuration
Finally, I edited my shell configuration (~/.zshrc) to remove the Homebrew path export:export PATH="/opt/homebrew/bin:$PATH"
- Then, I reloaded the shell environment:
source ~/.zshrc
The Result
By removing Homebrew and all the packages I previously installed (like gcc, php, python@3.13, curl, gettext, sqlite, image libraries, networking and security tools), I saved approximately 2.2 GB of disk space on my Mac Studio.

This cleanup helped keep my Mac running clean and lean, while I continue all programming tasks on my GhostBSD PC with XFCE, a simple and efficient FreeBSD-based environment well suited for development work.