Overview

Homebrew is a free and open-source package manager that simplifies the installation and management of software on macOS and Linux. It provides a convenient way to install, update, and uninstall software applications.

Key Concepts

Formulae:

A script that installs command-line tools and libraries using Homebrew. Think of it as a script to install CLI (command-line interface) apps.

Cask:

An extension of Homebrew that allows you to install macOS applications with graphical user interfaces (GUI) using Homebrew. Think of it as a script to install apps like Google Chrome, Slack etc.

Tap:

An external repository of formulae (and optionally casks) that extends the core functionality of Homebrew. It allows users to access additional packages that are not included in the default Homebrew repository.

Installation

The installation process for Macs (Intel, Apple Silicon) and Linux


Open your terminal and run this command

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

The above command will install Homebrew

Run this command to verify if Homebrew is installed

  brew --version

It should show something like Homebrew 4.3.10

Usage

Basic Commands

brew update

This command update Homebrew itself and its package information.


brew upgrade

This command updates all installed packages


brew outdated

This command shows all outdated packages


brew cleanup

This command removes outdated versions of installed packages


brew doctor

This command diagnoses issues with your Homebrew installation and suggests fixes.


brew config

This command displays detailed information about your Homebrew setup


Cask Commands

brew install --cask <cask_name>

This command installs a macOS application, make sure to replace the <cask_name> with the name of the application you want to install

Example

brew install --cask google-chrome

This command installs Google Chrome web browser


brew list --cask

This command displays a list of all casks (macOS apps) you have installed using Homebrew


brew upgrade --cask

This command updates all installed casks to their latest versions.


brew uninstall --cask <cask_name>

This command uninstalls a macOS application, make sure to replace the <cask_name> with the name of the application you want to uninstall

Example

brew uninstall --cask google-chrome

This command uninstalls Google Chrome web browser


Formulae Commands

brew install <formula_name>

This command installs a package (also known as a formula) from the Homebrew repository. Replace <formula_name> with the name of the package you want to install.

Example

brew install wget

This command installs the wget command-line tool for downloading files from the internet.


brew list

This command lists all the packages (formulae) you have installed using Homebrew.


brew upgrade

This command updates all installed formulae to their latest versions.


brew uninstall <formula_name>

This command uninstalls a package (formula) from your system. Replace <formula_name> with the name of the package you want to uninstall.

Example

brew uninstall wget

This command uninstalls the wget command-line tool.


Tap Commands

brew tap <user/repo>

This command adds a new tap (a third-party repository) to Homebrew. Replace <user/repo> with the name of the GitHub repository you want to tap.

Example

brew tap homebrew/cask

This command adds the Homebrew Cask repository, which contains macOS applications.


brew list --taps

This command lists all the taps you have added to Homebrew.


brew untap <user/repo>

This command removes a tap from Homebrew. Replace <user/repo> with the name of the repository you want to remove.

Example

brew untap homebrew/cask

This command removes the Homebrew Cask repository.


brew tap-info <user/repo>

This command provides detailed information about a specific tap. Replace <user/repo> with the name of the repository you want information about.

Example

brew tap-info homebrew/cask

This command displays detailed information about the Homebrew Cask repository.