How To Install Brew on macOS

Brew or Homebrew is the package manager for macOS and Linux. This tutorial will teach us how to install the brew command on macOS. Also, if you are getting the error message “brew command not found“, you can follow this article.

Homebrew or Brew is the most popular package manager for macOS and is the number one choice for package manager for macOS.

How to Install Brew on macOS

Installing Homebrew

Homebrew is a package manager that makes it easy to install software packages and dependencies on macOS.

To install the brew or Homebrew command or cli, open your Terminal app and run the following command:

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

This will start the brew installation process, and you just need to follow the instructions provided.

Verifying the Installation

After installing Homebrew, you can verify that it was installed correctly by running the following command in your Terminal app:

brew -v

This command will show you the installed version on your macOS.

 ~ brew -v     
Homebrew 4.0.15
Homebrew/homebrew-core (git revision a85f665b8d3; last commit 2023-04-26)

Installing Packages with Brew

Now that you have Homebrew installed, you can start using it to install software packages and dependencies.

To install a package with Brew on macOS, simply run the following command in your Terminal app:

brew install [package]

For example, to install the wget command, you would run the command brew install wget.

Brew will automatically download and install the latest version of the package, along with any dependencies that are required.

~ brew install wget
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 3 taps (hashicorp/tap, homebrew/core and homebrew/cask).
..................
..................
==> Fetching wget
==> Downloading https://ghcr.io/v2/homebrew/core/wget/manifests/1.21.4
################################################################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/wget/blobs/sha256:cf388783b9a7c9f017b3d7f176e8dbf6963f4a96d321a171a14e40
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:cf388783b9a7c9f017b3d7f176e8dbf6963f
################################################################################################################## 100.0%
==> Installing dependencies for wget: libunistring, libidn2, ca-certificates and openssl@3
==> Installing wget dependency: libunistring

After installing the package, you can run brew command again to verify it.

~ brew list wget
/usr/local/Cellar/wget/1.21.4/.bottle/etc/wgetrc
/usr/local/Cellar/wget/1.21.4/bin/wget
/usr/local/Cellar/wget/1.21.4/share/info/wget.info
/usr/local/Cellar/wget/1.21.4/share/locale/ (80 files)
/usr/local/Cellar/wget/1.21.4/share/man/man1/wget.1

Updating and Upgrading Packages

Brew makes it easy to keep your software packages and dependencies up to date. To update Brew itself, run the command brew update.

This will download the latest version of Brew and update your package list. To upgrade all installed packages to their latest versions, run the command brew upgrade.

To upgrade a specific package, run the command brew upgrade [package].

~ brew upgrade wget
Warning: wget 1.21.4 already installed
➜  ~ 

Conclusion

In conclusion, installing and using Brew on macOS is a straightforward process that can greatly simplify the installation and management of software packages and dependencies.

By following these simple steps, you can quickly get up and running with Brew and start taking advantage of its powerful package management capabilities.