Homebrew serves as the definitive package menagement solution for macOS, fulfilling a role similar to apt on Debian-based distributions or dnf on Red Hat systems. It streamlines the lifecycle of command-line tools and applications, covering installation, updates, and removal.
Installation
To install Homebrew, execute the following command in your Terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
If you have previously configured the environment, running the installer again will notify you if the package manager is already present on the system.
Managing Software
Installation
To add a new package to your system, use the install command followed by the name of the utility:
brew install <package-name>
Listing and Information
To retrieve a list of all currently managed packages, use the list command:
brew list
To view detailed metadata, version history, and configuration recommendations for a specific installed package, use the info flag:
brew info <package-name>
This output typically provides the installation path, dependency details, and important instructions regarding shell environment variables or configuration files.
Searching
If you are unsure of the exact package name, perform a search across the available repositories using fuzzy matching:
brew search <query>
This command returns all related formulas and casks matching you're search string, helping you identify the correct package.
Removal
To remove an application or tool from your system, use the uninstall command:
brew uninstall <package-name>
Essential Maintenance Commands
brew update: Synchronizes your local repository information with the remote Homebrew source to fetch the latest versions.brew upgrade: Updates all installed packages to their latest versions.brew deps <package-name>: Displays the dependency tree for a specific package.brew cleanup: Removes stale lock files and older versions of installed packages to reclaim disk space.