Easily Install Homebrew on Linux


Table of Contents

Homebrew is a popular package manager for macOS, but did you know that you can also install Homebrew on Linux? In this article, we will explore the basics of Homebrew and how to install and use it on your Linux system. Whether you are a seasoned Linux user or just starting out, Homebrew can be a valuable tool for managing packages and simplifying your workflow.

Benefits of Homebrew as a Package Manager

Before we dive into the installation process, let’s take a moment to understand why Homebrew can be a choice for managing packages on Linux.

Homebrew provides a simple and efficient way to install, update, and remove software packages on your system. It offers a vast collection of packages that are maintained by a dedicated community, ensuring that you have access to the latest versions of your favorite software.


Before we proceed with the installation, there are a few prerequisites that you need to check. First, make sure that your Linux system is compatible with Homebrew. While Homebrew is primarily designed for macOS, it can also be used on Linux distributions that support the x86_64 architecture.

Next, make sure that you have the necessary packages installed on your system. Homebrew relies on Linuxbrew, a fork of Homebrew specifically designed for Linux. If you don’t have Linuxbrew dependencies installed, you will need to install them before proceeding with the Homebrew installation.

Installing Homebrew on Linux

Now that we have completed the prerequisites let’s move on to the installation process. To install Homebrew on Linux, you can run the following command in your terminal –

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

This command will download and execute the installation script for Homebrew. It will guide you through the installation process and set up Homebrew on your Linux system.

Setting up Homebrew on Linux

Once the installation is complete, we must set up Homebrew by adding its path to our environment variables. This will allow us to access Homebrew’s executables from anywhere in the terminal.

To add the Homebrew path to your environment variables, run the following command –

echo 'export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"' >>~/.bash_profile 

This command appends the Homebrew path to the .bash_profile file in your home directory. If you are using a different shell, such as Zsh, make sure to modify the appropriate configuration file.

After adding the Homebrew path, we need to load the environment variables into our current shell. Run the following command to do so:

source ~/.bash_profile 

With these steps, Homebrew is now set up on your Linux system and ready to be used.

Basic Homebrew Usage

Now that Homebrew is installed and configured let’s explore some basic usage examples to get you started.

To search for a package, use the following command:

brew search 

Replace with the name of the package you want to search for. Homebrew will display a list of packages that match your search query.

To install a package, use the following command –

brew install 

Replace with the name of the package you want to install. Homebrew will download and install the package along with its dependencies.

To uninstall a package, use the following command –

brew uninstall 

Replace with the name of the package you want to uninstall. Homebrew will remove the package from your system.

To upgrade a package to the latest version, use the following command –

brew upgrade 

Replace with the name of the package you want to upgrade. Homebrew will check for updates and install the latest version if available.

To list all installed packages, use the following command –

brew list 

This command will display a list of all packages installed on your system using Homebrew.

Advanced Homebrew Usage

In addition to the basic usage examples, Homebrew offers some advanced features that can enhance your package management experience.

If you need to install a package that is not already available in the Homebrew repository, you can create a formula, also known as a Homebrew recipe, for that package. This allows you to install and manage custom packages using Homebrew.

To tap or add a repository to Homebrew and access additional packages, use the following command –

brew tap 

Replace with the name of the repository you want to tap. This will add the repository to Homebrew and make its packages available for installation.

If you need to install graphical applications, Homebrew provides a separate command called cask. You can use the following command to install a graphical application –

brew install --cask 

Replace with the name of the cask you want to install. Casks are specially packaged applications that can be installed using Homebrew.


In this article, we have covered the basics of Homebrew and how to install Homebrew on Linux. Homebrew provides a convenient way to manage packages on your Linux system, offering a wide range of software packages maintained by a dedicated community. We encourage you to experiment with Homebrew and explore its capabilities to enhance your Linux experience.

Note: This article assumes that the user is familiar with basic Linux command-line usage. If you are new to Linux, we recommend familiarizing yourself with the command-line interface before diving into Homebrew.

Linux Tutorials