Learn Homebrew: Fast and Efficient Software Management on macOS

Homebrew makes managing software on macOS fast and easy. With simple commands, you can install, update, and organise apps. Ready to streamline your macOS experience? Let’s get started!

What It Is #

Homebrew is a command-line package manager for macOS that simplifies software management. It automates installation, updates, and organisation of apps, eliminating manual downloads and complicated setups to keep your system running smoothly and up to date.

Why Use It #

Save time, keep your system tidy, and make your workflow smoother.

1. Fast Software Installation #

No more manual downloads from websites and dragging apps to the Applications folder. With a simple command, you can install a wide range of software:

bash
brew install <package_name>

2. Access to Thousands of Packages #

Homebrew has a massive collection of command-line tools and casks (GUI apps) via:

  • Core packages (CLI tools): brew install
  • Cask packages (GUI apps): brew install --cask

3. Easy Updates #

Keep all your packages updated with a single command:

bash
brew update && brew upgrade

4. Clean Uninstallation #

Remove packages without leaving junk behind:

bash
brew uninstall <package_name>

5. Lightweight and Non-Intrusive #

Homebrew installs everything in /opt/homebrew (Apple Silicon) or /usr/local (Intel), keeping your system clean and organized. It doesn’t clutter system directories or require sudo.

6. Scriptable Setup #

Pro tip: Use a Brewfile and brew bundle to install all your favourite packages at once.

Set up your Mac automatically:

bash
brew bundle dump
brew bundle install

Installation #

macOS:

bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Essential Commands #

1. Package Management #

Casks are apps with a graphical interface. Examples: LibreWolf and Visual Studio Code.

Install package (latest version):

bash
brew install <package_name>
bash
brew install --cask <package_name>

Install multiple packages:

bash
brew install ffmpeg imagemagick rclone
brew install --cask iterm2 librewolf visual-studio-code

Combined:

bash
brew install ffmpeg imagemagick rclone && brew install --cask iterm2 librewolf visual-studio-code

Uninstall package:

bash
brew uninstall <package_name>
bash
brew uninstall --cask <package_name>

2. Updates & Upgrades #

Update Homebrew:

bash
brew update

Upgrade installed packages:

Upgrade all the installed packages to latest version.

bash
brew upgrade

Update Homebrew and installed packages:

bash
brew update && brew upgrade

Upgrade specific package:

bash
brew upgrade <package_name>

Upgrade all casks (GUI apps):

bash
brew upgrade --cask

Pin package to prevent upgrade:

bash
brew pin <package_name>

To allow upgrades again:

bash
brew unpin <package_name>

3. Package Info #

List installed packages:

bash
brew list

Get package info:

bash
brew info <package_name>

List all packages with newer versions available:

bash
brew outdated

Search for package:

bash
brew search <package_name>

List all casks (GUI apps):

bash
brew list --cask

4. System Maintenance & Cleanup #

Cleanup old versions:

Remove old versions of installed packages and free up disk space.

bash
brew cleanup

Check system compatibility:

Check system for issues, such as configuration problems or outdated files.

bash
brew doctor

Fix installation issues:

Use to identify any missing dependencies for installed packages.

bash
brew missing

5. Configuration #

Show Homebrew configuration:

bash
brew config

Homebrew analytics

Disable:

bash
brew analytics off

Enable:

bash
brew analytics on

6. Advanced Features #

Create a Brewfile (save in current directory):

Create a list of installed packages.

bash
brew bundle dump

If a Brewfile already exists, use:

bash
brew bundle dump --force

Create a Brewfile (save in custom directory):

bash
brew bundle dump --file=<path/to/>Brewfile

Install from Brewfile (default path):

Default path: ~/Brewfile.

bash
brew bundle install

Install from Brewfile (custom path):

bash
brew bundle --file=<path/to/>Brewfile

7. Handling Services #

Start:

bash
brew services start <package_name>

Stop:

bash
brew services stop <package_name>

Restart:

bash
brew services restart <package_name>

List running services:

bash
brew services restart <package_name>

8. Handling Errors & Logs #

View logs:

bash
brew log <package_name>

Force reinstall:

bash
brew reinstall <package_name>

My Favorite Packages #

These are the essential packages I always install on a fresh macOS setup:

Core Packages (CLI Tools) #

  • bat – A cat clone with syntax highlighting.
  • bitwarden-cli – Command-line access to your Bitwarden vault.
  • coreutils – GNU core utilities, replaces many BSD/macOS defaults with GNU versions.
  • curl – Tool for transferring data with URLs, supports multiple protocols.
  • ffmpeg – Powerful tool for video and audio processing.
  • gd – Graphics library for dynamic image creation (used in web and image tools).
  • htop – Interactive process viewer, better than top.
  • imagemagick – Suite for editing, converting, and displaying images from the command line.
  • rclone – Command-line tool for syncing files with cloud storage providers.
  • rsync – Fast and versatile file-copying tool, ideal for backups and remote sync.

Cask Packages (GUI Apps) #

  • bitwarden – Secure, open-source password manager.
  • librewolf – Privacy-focused Firefox fork with hardened defaults.
  • lulu – Free, open-source firewall for macOS.
  • malwarebytes – Malware scanner and removal tool for macOS.
  • oversight – Alerts you when your mic or camera is activated.
  • spotify – Popular music streaming application.
  • iterm2 – A more capable terminal than the default macOS Terminal.
  • visual-studio-code – Popular code editor with a huge ecosystem.
  • vlc – Versatile media player that supports virtually every format.
  • vmware-fusion – Virtualization software for running other operating systems on macOS.