This guide will teach you How To Install Homebrew or Brew on Ubuntu 22.04.
Homebrew (brew) is a free and open-source package manager that allows installing apps and software in macOS and Linux, depending on the user’s desire. It has been recommended for its simplicity and effectiveness in saving time and effort. Its famous description is “The missing package manager for macOS”.
Steps To Install Homebrew on Ubuntu 22.04
To complete this guide, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide on Initial Server Setup with Ubuntu 22.04.
Install Brew on Ubutnu 22.04
First, you need to update your local package index with the following command:
sudo apt update
Install build-essential package
Then, you need to install the build-essential package on your server. To do this run the command below:
sudo apt install build-essential -y
build-essential is what is called a meta-package. It in itself does not install anything. Instead, it is a link to several other packages that will be installed as dependencies.
Now you need to install git on Ubuntu 22.04 with the following command:
sudo apt install git -y
Brew’s official website provides a script for downloading and installing Homebrew.
Download Homebrew Installer Script
You can download and run the Homebrew script with the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
This will take some time to complete.
When your Homebrew installation on Ubuntu 22.04 is completed, you need to add the Brew command to the system path:
# echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/orca/.profile # eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
The eval command is used to execute the arguments as a shell command on UNIX or Linux systems.
Then, you need to install GCC with the brew command on your server:
brew install gcc
At this point, run the brew help to get started the Homebrew on Ubuntu 22.04:
Output 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
To verify that Homebrew is working correctly on Ubuntu 22.04, run the following command:
Output Your system is ready to brew.
For more information, you can visit the Homebrew documentation page.
At this point, you have learned to Install Homebrew (brew) on Ubuntu 22.04.
Hope you enjoy it.
Also, you may be like these articles: