Homebrew is an application that lets you install and uninstall applications with a single line of command. It is a must-have application for MacBook users. In this article, we will learn how to install homebrew.
Homebrew
Homebrew is a package management application for the Mac that was developed in Ruby.
You can install applications by typing commands in the Terminal rather than downloading and running an installation file. This convenience has made it a must-have for MacOS users. It has become the standard package management application for MacOS.
How to install homebrew
To install Homebrew, launch Terminal and run the Homebrew installation script by typing the following command in the Terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
When the window to enter the administrator password appears as shown below, enter the password and proceed with the installation.
Press ENTER to proceed with installation.
Wait until installation is complete.
Add the Homebrew path to your PATH environment variable and use the brew --version
command to verify that it is installed properly.
# add the homebrew path in zshrc file
$ echo 'export PATH=/opt/homebrew/bin:$PATH' >> ~/.zshrc
# reload zshrc
$ source ~/.zshrc
$ brew --version
Homebrew 4.2.15
How to use Homebrew
Install Package
To install a package using Homebrew, use the Brew install command. For example, to install wget, use the following command:
# search wget
$ brew search wget
==> Formulae
wget wget2 wgetpaste
# install wget
$ brew install wget
Package List and Information
To check the installed packages, use the brew list
command, and to get information about a specific package, use the brew info
command. For example, to see information about wget, use the following command :
$ brew list
==> Formulae
wget
$ brew info wget
==> wget: stable 1.24.5 (bottled), HEAD
Internet file retriever
https://www.gnu.org/software/wget/
/opt/homebrew/Cellar/wget/1.24.5 (91 files, 4.5MB) *
Poured from bottle using the formulae.brew.sh API on 2024-04-02 at 01:01:40
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/w/wget.rb
License: GPL-3.0-or-later
==> Dependencies
Build: pkg-config ✔
Required: libidn2 ✔, openssl@3 ✔
==> Options
--HEAD
Install HEAD version
==> Analytics
install: 149,534 (30 days), 260,316 (90 days), 994,516 (365 days)
install-on-request: 149,239 (30 days), 259,801 (90 days), 992,595 (365 days)
build-error: 12 (30 days)
Update Packages
To update Homebrew and all installed packages to the latest version, first run brew update
to update Homebrew, then run brew upgrade
to update all packages.
$ brew upgrade wget
Remove Packages
To remove installed packages, use the Brew uninstall command. For example, to remove wget, use the following command :
$ brew uninstall wget
Homebrew Commands
# brew usage
$ brew
Example usage:
brew search TEXT|/REGEX/
brew info [FORMULA|CASK...]
brew install FORMULA|CASK...
brew update
brew upgrade [FORMULA|CASK...]
brew uninstall FORMULA|CASK...
brew list [FORMULA|CASK...]
Troubleshooting:
brew config
brew doctor
brew install --verbose --debug FORMULA|CASK
Contributing:
brew create URL [--no-fetch]
brew edit [FORMULA|CASK...]
Further help:
brew commands
brew help [COMMAND]
man brew
https://docs.brew.sh
- brew update : Update brew to the lastest version.
- brew search <PackageName> :Search for installable programs
- brew install <PackageName>[@version] : Install specific version
- brew upgrade <PackageName> : Upgrade Package
- brew upgrade : Upgrade all packages
Package Information
- brew list : List of installed programs
- brew info <PackageName> : View package information
- brew outdated : Find programs that need upgrading
Remove
- brew cleanup <PackageName> : Remove non-lastest version
- brew uninstall <PackageName> : Remove program
Remove Homebrew
To install Homebrew, launch Terminal and run the Homebrew removal script by pasting the following command into the terminal :
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
Remove the /opt/homebrew folder. Please note that if you remove the folder, the programs installed through Homebrew may also be removed.