How to Install Homebrew on Linux

Hi everyone, in this article, we will show you how to install and use Homebrew on Linux. Homebrew, also known as Brew, is a command line package manager developed mainly for macOS. Homebrew became very popular among macOS users as more and more developers created command line tools that could be easily installed using Homebrew. This popularity led to the creation of Linuxbrew, a Linux port of Homebrew. Since Homebrew is mostly Git and Ruby, and Linux and macOS are both Unix-like systems, Homebrew works well on both operating systems. So without further delay, let’s get started.

macOS is responsible for the original development of the Homebrew package manager. This package manager allows Linux users to effortlessly install free and open source software packages via their command line environment. One might think that the various popular Linux distributions already come with their own package managers such as APT, DNF, YUM, PACMAN and ZYPPER. These standard package managers are indeed sufficient to retrieve and install tools and programs from maintained and trusted package sources. However, these package managers are not always the best solution for all practical scenarios.

How to Install Homebrew on Linux

Installing a Compiler Environment

Step 1: Before you install Homebrew, you need a working compiler so that Homebrew can build packages. While most packages are precompiled, some package dependencies must be built directly on your machine. Most Linux distributions allow you to install a compiler with a single command, but do not provide a default compiler. On Ubuntu, you can install a package called build-essential that contains all the packages needed for a modern, well-supported compiler environment. Install the package with apt:

sudo apt install build-essential

Step 2: On Rocky Linux, CentOS, or other RedHat derivatives, you can install a group of packages called Development Tools that provide the same compiler functionality. Install the packages with dnf:

dnf groups mark install “Development Tools”dnf groupinstall “Development Tools”

Step 3: You can verify that a compiler is available by checking for the existence of the make command on your system. In order to do that, use the which command:

which make

Now that you have a working compiler, you can proceed to install Homebrew.

Installing and Setting Up Homebrew

Step 1: To install Homebrew, you’ll download an installation script and then execute the script. First, download the script to your local machine:

curl -fsSL -o install.sh https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh

Step 2: The command uses curl to download the Homebrew installation script from Homebrew’s Git repository on GitHub. Let’s walk through the flags that are associated with the curl command:

  • The -f or –fail flag tells the shell to give no HTML document output on server errors.
  • The -s or –silent flag mutes curl so that it does not show the progress meter, and combined with the -S or –show-error flag it will ensure that curl shows an error message if it fails.
  • The -L or –location flag will tell curl to handle redirects. If the server reports that the requested page has moved to a different location, it’ll automatically execute the request again using the new location.
  • The -o switch specifies a local filename for the file. Rather than displaying the contents to the screen, the -o switch saves the contents into the file you specify.

Step 3: Before running a script you’ve downloaded from the Internet, you should review its contents so you know what the script will do. Use the less command to review the installation script so you understand what it will do.

less install.sh

Step 4: Once you’re comfortable with the contents of the script, execute the script with the bash command:

/bin/bash install.sh

Step 5: The installation script will explain what it will do and will prompt you to confirm that you want to do it. This lets you know exactly what Homebrew is going to do to your system before you let it proceed. It also ensures you have the prerequisites in place before it continues.

Step 6: You’ll be prompted to enter your password during the process. If you do not have sudo privileges, you can press Ctrl+D instead to bypass this prompt, and Homebrew will be installed with more restrictive permissions. You can review this option in Homebrew’s documentation.

Step 7: Press the letter y for “yes” whenever you are prompted to confirm the installation.

Installing, Upgrading, and Removing Packages

Step 1: Now that Homebrew is installed, use it to download a package. The tree command lets you see a graphical directory tree and is available via Homebrew. Install tree with the brew install command:

brew install tree

Step 2: Homebrew will update its list of packages and then download and install the tree command: Homebrew installs files to /home/linuxbrew/.linuxbrew/bin/ by default, so they won’t interfere with future Linux updates. Verify that tree is installed by displaying the command’s location with the which command:

which tree

Final Words

We hope you like our article about installing Homebrew on Linux. Homebrew is one of the most popular package managers for Mac OS X, but it can also be installed on Linux to download and install various packages. So if you like our article, please share it with others.

I hope you understand this article, How to Install Homebrew on Linux.

Editorial Staff
Editorial Staffhttps://www.bollyinside.com
The Bollyinside editorial staff is made up of tech experts with more than 10 years of experience Led by Sumit Chauhan. We started in 2014 and now Bollyinside is a leading tech resource, offering everything from product reviews and tech guides to marketing tips. Think of us as your go-to tech encyclopedia!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Related Articles

Best Telemedicine Software: for your healthcare practice

Telemedicine software has transformed my healthcare visits. It's fantastic for patients and doctors since they can obtain aid quickly. I...
Read more
I love microlearning Platforms in today's fast-paced world. Short, focused teachings that engage me are key. Microlearning platforms are great...
Think of a notebook on your computer or tablet that can be changed to fit whatever you want to write...
As of late, Homeschool Apps has gained a lot of popularity, which means that an increasing number of...
From what I've seen, HelpDesk software is essential for modern businesses to run easily. It's especially useful for improving customer...
For all of our important pictures, stories, and drawings, Google Drive is like a big toy box. But sometimes the...