LinuxCommandLibrary

brew-rm

Uninstall Homebrew packages

TLDR

View documentation for the original command

$ tldr brew uninstall
copy

SYNOPSIS

brew rm [options] <formula> [...formula]

PARAMETERS

-f, --force
    Removes all installed versions of the specified formula, even if it is a dependency of another currently installed formula. Without this option, Homebrew will prevent the uninstallation of a formula that is still required by other installed packages.

<formula> [...]
    One or more names of formulas (packages) to be uninstalled. Multiple formulas can be specified, separated by spaces.

DESCRIPTION

While "brew-rm" is not a native Linux command, it refers to the brew rm command, which is an alias for brew uninstall within the Homebrew package manager. Homebrew is widely used on macOS and is also available on Linux (often referred to as Linuxbrew). The brew rm command's primary function is to remove or uninstall one or more specified formulas (packages) from your Homebrew installation. It handles the removal of the package's installed files from the Homebrew cellar, making the software unavailable. Unlike some other package managers, brew rm by default does not automatically remove packages that were installed as dependencies of the uninstalled formula. This design choice provides users with more control over their installed libraries but requires explicit action (e.g., using brew autoremove or brew cleanup) to free up space from no-longer-needed dependencies.

CAVEATS

brew rm is not a standard, pre-installed Linux command; it is part of the Homebrew package manager. If Homebrew is not installed on your system, this command will not be available.
By default, brew rm does not remove packages that were installed as dependencies of the uninstalled formula. These orphaned dependencies remain installed and must be removed separately using commands like brew autoremove or brew cleanup.
The command generally removes only files managed by Homebrew in its cellar; it typically does not remove user configuration files or data directories created by the software.

DEPENDENCY MANAGEMENT

When you uninstall a formula with brew rm, its dependencies are not automatically removed. To remove unused dependencies and old versions of formulas, you can use:

  • brew autoremove: Removes formulas that were installed as dependencies but are no longer required by any installed formula.
  • brew cleanup: Removes stale lock files and old versions of installed formulas, as well as their outdated downloads from the Homebrew cache.

FORMULA VS. CASK

Homebrew manages two types of packages:

  • Formulas: These are command-line tools and libraries (e.g., `git`, `python`). brew rm is used for formulas.
  • Casks: These are graphical macOS applications (e.g., `google-chrome`, `vlc`). Casks are uninstalled using brew uninstall --cask <cask_name> (or `brew rm --cask`). The `--zap` option can be used with casks to remove all associated files, including support files and preferences.

HISTORY

The brew rm command, as an alias for brew uninstall, is an integral part of Homebrew, which was initially released in 2009 by Max Howell for macOS. Its clean design and simplicity quickly made it the de facto package manager for Mac. The concept of using a 'Cellar' for package installations and symlinking them into standard paths (like /usr/local/bin) was a key innovation. As Homebrew gained popularity, efforts to port it to Linux emerged, eventually leading to Linuxbrew (now integrated back into Homebrew). The rm/uninstall command has been a core component since the early days, providing a straightforward way for users to manage their installed software by removing packages when no longer needed.

SEE ALSO

brew install(1), brew list(1), brew cleanup(1), brew autoremove(1), apt remove(8), dnf remove(8), yum remove(8), pacman -R(8)

Copied to clipboard