Skip to content

Managing Packages with Homebrew on macOS

Homebrew is the most popular package manager for macOS, providing a simple and efficient way to install, update, and manage software packages. It streamlines the process of maintaining software on your Mac through command-line interface.

Package Management

  • Install, update, and remove software packages
  • Manage dependencies automatically
  • Track installed formulae and casks
  • Handle system-wide and user-specific installations
Terminal window
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Basic Package Operations

Terminal window
# Install a package
brew install wget
# Search for packages
brew search python
# Remove a package
brew uninstall wget
# List installed packages
brew list

Update Operations

Terminal window
# Update Homebrew and formulae
brew update
# Show outdated packages
brew outdated
# Upgrade all packages
brew upgrade
# Upgrade specific package
brew upgrade node

Maintenance Operations

Terminal window
# Clean up old versions
brew cleanup
# Check system for potential problems
brew doctor
# Display package information
brew info postgresql

Service Management

Terminal window
# Start a service
brew services start postgresql
# List running services
brew services list
# Stop a service
brew services stop postgresql

Cask Operations

Terminal window
# Install GUI applications
brew install --cask firefox
# List installed casks
brew list --cask

Prerequisites

  • macOS 10.14 or higher
  • Command Line Tools for Xcode
  • Administrator privileges for installation