Uninstalling packages installed with Homebrew
Homebrew is usually one of the first software a developer installs in macOS. It provides a Linux-like package management interface to easily install and manage software. The most used options with brew are install
and upgrade
.
The commands brew uninstall
and brew remove
can be used to uninstall a package installed through Homebrew.
Examples:
$ brew uninstall postgresql
$ brew remove mysql
Advanced Uses
Dependencies: You can prevent Homebrew from uninstalling package dependencies using the --ignore-dependencies
option. You may want to use this option when uninstalling a package that introduces a lot of dependencies that may be used by other packages. You may want to use this option when removing packages such as Ruby, Python, and Node JS. I personally don't use this option and prefer to have a clean state. If any app breaks, I will inspect the logs, identify the missing library and install it when needed.
$ brew uninstall --ignore-dependencies postgresql
To identify a full list of dependencies you can use the deps
option.
$ brew deps ruby
ca-certificates
libyaml
openssl@1.1
readline
Force Remove: The force option will ignore errors and uninstall all versions of the formula installed.
$ brew uninstall -f postgresql
About the Author
Ziyan Junaideen -
Ziyan is an expert Ruby on Rails web developer with 8 years of experience specializing in SaaS applications. He spends his free time he writes blogs, drawing on his iPad, shoots photos.