brew
— 2 min read
brew
is the command-line interface for Homebrew, which is a free and open-source software package management system designed for macOS (and later extended to Linux under the name "Linuxbrew"). Here's a more detailed breakdown:
What is Homebrew?
Homebrew is often referred to as the "missing package manager for macOS". Before Homebrew, macOS did not have a standard package manager like apt
for Ubuntu or yum
for CentOS. Homebrew fills that gap by providing an easy way to install, update, and manage software packages on macOS (and Linux).
Key Features and Concepts of Homebrew:
- Formulae: At the heart of Homebrew are formulae, which are Ruby scripts that define how a particular package should be installed. They reside in the main Homebrew repository on GitHub.
- Casks: While Homebrew initially focused on command-line tools, "Homebrew Cask" extends this to macOS applications and large binaries. Using casks, you can install applications like Google Chrome, VLC, etc.
- Taps: Homebrew's default repository contains a collection of formulae, but not all of them. "Tapping" an additional repository means you're adding more formulae/casks that aren't in the default set. This allows third-party repositories to provide their own formulae.
- Cellar: Once a package (formula) is installed, its files are stored in the "Cellar" and symlinked to appropriate directories. This makes managing and versioning easier.
- Bottles: These are pre-built binary packages, which means you don’t have to compile the software from source (which can be time-consuming). If available, Homebrew will use a bottle to install software, making the process faster.
Common Commands:
brew install <package>
: Installs a package.brew uninstall <package>
: Removes a package.brew doctor
: Check system for potential problemsbrew update
: Updates the Homebrew package database.brew upgrade
: Upgrades all outdated packages.brew list
: Lists all installed packages.brew search <text>
: Searches for available packages.brew info <package>
: Provides information about a package.brew tap <repository>
: Adds a new third-party repository.brew cask install <application>
: Installs an application via Homebrew Cask.
Brew examples
# check if there's any other versions of awsclibrew list | grep awscli
# remove left over binaryrm -rf /opt/homebrew/bin/aws