How to Install Homebrew on Linux

How to Install Homebrew on Linux

If you want to know how to install Homebrew on Linux and why it’s a good idea, you’re on the right article. 

To follow the steps mentioned in this article to install Homebrew, ensure that you have a system with Linux installed and use a root account (or an account with sudo privileges). Also, you should have git software installed on your system.

Introduction to Homebrew

Homebrew is a package management utility that’s compatible with almost all major operating systems (OS). Packages can normally be installed via built-in package managers in most operating systems, such as apt and dnf. However, these default package managers are not always reliable and often don’t work. 

Therefore, package managers like Homebrew have emerged. 

The following are the main features of Homebrew:

  • It is supported by all major operating systems (OS), such as macOS, Linux, and Windows
  • It can be used to install software that is not packaged along with your host distribution
  • It can also be used to install an updated version of any software in case your host distribution is quite dated
  • You can also use the Homebrew to manage your operating system

How to Install Homebrew on Linux?

We will now discuss the installation steps for Homebrew. There are two main steps for installation:

  • Checking the dependencies
  • Running the installation scripts

Let’s examine each of these steps in detail.

Installing the dependencies

Since Homebrew employs a compiler for building packages, we need to check if the make utility is installed on your system.

Checking if the make utility is installed

To check that the make is installed on your computer, open the Terminal from the System Menu and then type the following command:

$make --version


If the make is installed, you will see the version of Make installed on your system.

Installation of Make (if required)

If the make utility is not installed, you can install it with the help of the following command:

$sudo apt install build-essential


The above command will install the build-essential. This package comprises make utility and other packages for compiling other packages. Press ‘Y’ to confirm and then press Enter. It will take a while to install the utility.

Installation of Homebrew

Now, follow the steps below to download the Homebrew script and install it.

Download the Homebrew

The very first step is to download the Homebrew package. Visit the official website of Homebrew (https://brew.sh/). Now, copy the curl command, as shown in the snapshot below.

install Homebrew

This command should look like the following:

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


Install Homebrew

Open the terminal as mentioned in previous sections and type the following command (as you copied from the website) on the Terminal to install the Homebrew:

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

Setting the path

After the installation of the Homebrew set the path. For this purpose, type the following command on the Terminal. This will add the path to the profile in the home directory:

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


Also, execute the following command:

eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

Verify the installation

The above steps ensure that Homebrew has been installed and configured on your system. You can verify the installation of Homebrew by running the following command:

$brew doctor


You should see a message: “Your system is ready to brew.” This will confirm that the installation is successful.

Updating the formulae list

After the installation of Homebrew, update the formulae list by running the following command:

$brew update


In some situations, you may be required to run the following command:

$brew upgrade

Should you like to upgrade specific formula, run the following command:

$brew upgrade [formula]

Tip: Package definitions are referred to as formulas in Homebrew.

Usage of the Homebrew

After installing Homebrew, you can use it for package management. For instance, you can search for specific formulae with the help of the following command:

$brew search htop

The above command will search for htop formulae. If it is available, an appropriate message is displayed. To install this formula, use the following command:

$brew install htop

Finally, the formula can be uninstalled with the help of the following command:

$brew uninstall htop

Uninstalling Homebrew

There are situations where you may want to uninstall a specific software. For instance, the software needs to be fixed, and a new version or a better alternative is available. Should you wish to uninstall Homebrew, visit the website of Homebrew and copy the curl command for uninstallation. Now, open the terminal and type the command copied as shown below:

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

After running the above command in the terminal, you may be asked to confirm the uninstallation. Press ‘Y’ and then enter to confirm the uninstallation of Homebrew. It will take some time to uninstall Homebrew from your computer.

In this article, we have discussed the Homebrew software. We discussed the basic features of the software and then the steps for the installation of the software. There are specific prerequisites for installation. These prerequisites are first discussed, followed by the software’s installation. The article also discusses the configuration of the software. Finally, the article also discussed the uninstallation steps for Homebrew.

If this guide helped you, please share it.

Leave a Reply
Related Posts