Homebrew is a package manager for macOS and Linux that makes it easy to install, update, and manage developer tools and command-line software.
Instead of manually downloading software, finding installers, configuring paths, and managing updates, you can often install a package with a single command.
For example:
brew install node That command downloads and installs Node.js along with what it needs.
On macOS, Homebrew is commonly installed from the Terminal using its official installation command.
After installation, verify that it works:
brew --version You should see the installed Homebrew version.
You can also check where Homebrew is installed:
which brew On Apple Silicon Macs, Homebrew is typically installed under:
/opt/homebrew On Intel Macs, it is commonly under:
/usr/local Before installing software, it is useful to update Homebrew’s package information:
brew update This updates Homebrew’s knowledge of available packages and their latest versions.
You can check whether anything needs updating with:
brew outdated The basic syntax is:
brew install package-name For example:
brew install node Other common development tools include:
brew install git
brew install python
brew install wget
brew install curl You can install multiple packages in one command:
brew install git node python If you don’t remember the exact package name, search for it:
brew search python You can then choose the appropriate package from the results.
To get information about a package:
brew info node This can show its version, installation location, dependencies, and other useful information.
To see software installed through Homebrew:
brew list For a more detailed list of installed formulae:
brew list --formula You can also inspect installed applications known as casks:
brew list --cask Homebrew can also install many macOS applications through Homebrew Cask.
For example:
brew install --cask visual-studio-code Other examples include:
brew install --cask google-chrome
brew install --cask firefox
brew install --cask iterm2 Casks are particularly useful when you want to manage desktop applications from the command line.
To upgrade outdated Homebrew packages:
brew upgrade To upgrade a specific package:
brew upgrade node For cask applications:
brew upgrade --cask You can also perform:
brew update
brew upgrade to update Homebrew’s package information and then upgrade installed packages.
If you no longer need a package:
brew uninstall node For a cask:
brew uninstall --cask visual-studio-code You can verify that it has been removed with:
brew list Homebrew can accumulate older versions and cached downloads.
Run:
brew cleanup To see what would be removed without actually deleting anything:
brew cleanup --dry-run This is useful for recovering disk space.
Homebrew can manage background services such as databases and development servers.
For example, after installing MySQL:
brew install mysql You can start it as a background service:
brew services start mysql Check running Homebrew services:
brew services list Stop the service:
brew services stop mysql This is especially useful when setting up local development environments.
Sometimes a project requires a particular version of a tool.
Homebrew provides versioned formulae when available. For example:
brew search node may reveal available versioned packages.
You can then install the required version if Homebrew provides it.
However, Homebrew is generally designed around current package versions, so developers who need to switch between many versions often use specialized version managers such as nvm, pyenv, or similar tools.
Use:
brew --prefix To find the installation directory of a particular package:
brew --prefix node You can also inspect package information:
brew info node This is helpful when troubleshooting PATH issues or locating configuration files.
Homebrew provides a diagnostic command:
brew doctor It checks your Homebrew environment for potential problems.
If it reports warnings, read them carefully before making changes. Some warnings are informational rather than critical.
| Command | Purpose |
|---|---|
brew --version | Show Homebrew version |
brew update | Update Homebrew metadata |
brew upgrade | Upgrade installed packages |
brew search name | Search for packages |
brew info name | Show package information |
brew install name | Install a package |
brew uninstall name | Remove a package |
brew list | List installed packages |
brew outdated | Show outdated packages |
brew cleanup | Remove old cached versions |
brew doctor | Diagnose potential problems |
brew services list | List Homebrew services |
brew services start name | Start a service |
brew services stop name | Stop a service |
Homebrew becomes particularly useful when setting up a development machine.
A new developer can quickly install tools such as:
brew install git
brew install node
brew install python
brew install php
brew install mysql Instead of searching for each installer individually, Homebrew provides a consistent command-line workflow.
You can think of the basic workflow as:
SEARCH
↓
INSTALL
↓
USE
↓
UPDATE
↓
UPGRADE
↓
CLEAN UP Suppose you want to build a Node.js application on a new Mac.
You could install Node.js:
brew install node Verify it:
node --version Verify npm:
npm --version Then create a project:
mkdir my-app
cd my-app
npm init -y Homebrew handled the system-level installation, while npm handles Node.js packages inside your project.
Homebrew and npm are not the same thing.
Homebrew manages system-level software:
brew install node npm manages JavaScript packages:
npm install express So a typical development setup might use both:
Homebrew
↓
Node.js
↓
npm
↓
JavaScript packages
↓
Your application Homebrew is therefore more than an installer. It provides a convenient way to build and maintain a reproducible command-line development environment on macOS and Linux.
Latest tech news and coding tips.
JavaScript gives you several ways to iterate over an array. Some are better for simple…
A web server is the software responsible for receiving requests from clients, processing those requests,…
A shell prompt is the text displayed by a command-line shell to show that it is ready…
A SOC Analyst (Security Operations Center Analyst) is one of the frontline defenders of an organization’s cybersecurity…
Most image upload systems assume one thing: the user has a stable internet connection. That assumption…
Imagine a user submits a form while their internet connection suddenly disappears. Normally, the request…