How to Install macOS Homebrew Package Manager on Linux

0

Jack Wallen walks you through the steps of installing the macOS Homebrew command line package manager on Linux.

Image: Ilias/Adobe Stock

Homebrew is a command line package manager for macOS similar to apt-get or dnf. Homebrew makes it easy to install over 5,000 apps from the command line. Some of the tools found in Homebrew aren’t available to any of the default Linux package managers and some packages found in the apt and yum repositories aren’t exactly well maintained.

SEE: 40+ open source and Linux terms you need to know (TechRepublic Premium)

For these reasons, you might want to add Homebrew to your Linux distributions. To add even more fuel to that fire, with Homebrew you can install the latest versions of packages, even on older Linux distributions. This is a big plus for many.

So if this sounds like a winning proposition to you, let me show you how it’s done.

What you will need to install Homebrew

The only things you will need are a running instance of a Debian or RHEL based distribution and a user with sudo privileges.

How to install the necessary dependencies

The first thing we need to do is install the required build tools. If you are using a Debian-based distro, such as Ubuntu, Linux Mint, or Pop!_OS, this is done with the command:

sudo apt-get install build-essential procps curl file git -y

If you are using an RHEL-based distribution, such as Fedora, Rocky Linux, or AlmaLinux, you need to run three commands:

sudo yum group install 'Development Tools'
sudo yum install procps-ng curl file git
sudo yum install libxcrypt-compat

How to Install Homebrew

With dependencies out of the way, we can now install Homebrew with the command:

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

The above command will work on Debian or RHEL based distributions.

Once the installation is complete (this will take some time), you will need to ensure that the brew command is in your PATH with the following two commands:

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

How to update the infusion

Before installing your first package, you must update the Homebrew definitions, which is done with the command:

brew update

You can also install Cask, which adds GUI apps to the mix. It’s also a good way to show you how to install a package with Homebrew. To install Cask, run the command:

brew install cask

If you want to update a package with brew, the command is:

brew upgrade PACKAGE

Where PACKAGE is the software you want to install.

To remove a package with brew, the command is:

brew uninstall PACKAGE

Where PACKAGE is the software to remove.

Finally, if you ever want to remove Homebrew from Linux, the command is:

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

And that’s how you manage packages with the brew command. You can search for all packages available for installation from the Homebrew Website. Take advantage of these additional tools on your favorite Linux distribution.

Subscribe to TechRepublic How to make the technology work on YouTube for all the latest tech tips for professionals from Jack Wallen.

Share.

Comments are closed.