Linux Commands

How to Install Homebrew on Linux

Struggling to install applications on your Linux system using the default package manager then try the homebrew package manager. Homebrew comes in handy when users need to install any application that is not available in the default repositories of Linux.

Moreover, this package manager has more than 5000 packages and one thing which makes this package manager better than others is that it maintains packages in a much better way. So, if you are looking for a way to install homebrew package manager for your Linux then go through this guide.

Installing Homebrew on Linux

Homebrew previously known as Linuxbrew can be the best choice to install Unix tools and the software that are available for free just go through the following steps to install Homebrew on your Linux system:

Step 1: Before beginning to install any application or software it is advisable to update the list of packages on your Linux system using:

$ sudo apt update

Step 2: Now check if make command is installed on your system using:

$ make --version

If not, then using the following command to install it:

$ sudo apt install build-essential -y

Step 3: Now install git as it is one of the required dependencies for installing the Homebrew package manager so install git using:

$ sudo apt install git -y

Step 4: The Homebrew provides the bash command to download and install it on any Linux system, to get that command go to official Homebrew website and copy the command from there:

Graphical user interface, website Description automatically generated

After copying the command paste it on your Linux terminal and execute it:

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

To prompt the installation process press, Enter from the keyboard.

Text Description automatically generated

Now the downloading and installation of Homebrew will start, it might take a while so wait patiently:

A screenshot of a computer Description automatically generated with medium confidence

Step 5: After the installation is completed now add the Homebrew to the path using the following command with admin privileges, just replace the username with your system username:

$ echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/<user_name>/.profile

Replace the <user_name> in the above command:

Now add the Homebrew to the path of home directory using:

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

Graphical user interface, text Description automatically generated

Step 6: Once you are done with installation process its time to see if the Homebrew is installed correctly and for that use:

$ brew doctor

Graphical user interface, text, application Description automatically generated

Now update the brew packages list using:

$ brew update

So, this is how one can install Homebrew on their macOS or on any Linux system and install the desired applications.

Conclusion

Homebrew is a package manager that is much better than other packages managers Linux use and there are two reasons to support it: one it has more than 5000 packages which are also called formulae and second it maintains the packages in a more efficient manner than any other package manager. To install Homebrew on Linux one needs to ensure that the make and git are installed on the system.

About the author

Aaliyan Javaid

I am an electrical engineer and a technical blogger. My keen interest in embedded systems has led me to write and share my knowledge about them.