Jack Wallen walks you through the steps of installing the macOS command line package manager Homebrew on Linux.
Homebrew is a command line package manager for macOS that is similar to apt-get or dnf. Homebrew makes installing over 5,000 applications from the command line very simple. 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)
Because of those reasons, you might want to add Homebrew to your Linux distros. To add even more fuel to this fire, with Homebrew, you can install the latest releases of packages — even on older Linux distributions. That’s 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’ll need to install Homebrew
The only things you’ll need are a running instance of either a Debian- or RHEL-based distribution and a user with sudo privileges.
How to install the necessary dependencies
The first thing we must do is install the required build tools. If you’re using a Debian-based distribution — 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’re using an RHEL-based distribution — such as Fedora, Rocky Linux, or AlmaLinux — there are three commands to run, which are:
sudo yum group install 'Development Tools'
sudo yum install procps-ng curl file git
sudo yum install libxcrypt-compat
How to install Homebrew
With the 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 either Debian- or RHEL-based distributions.
When the installation completes (it will take some time), you’ll need to make sure the brew command is found 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 brew
Before you install your first package, you need to update the Homebrew definitions, which is done with the command:
You might also want to install Cask, which adds GUI applications into the mix. This is also a good way to show you how to install a package with Homebrew. To install Cask, issue the command:
brew install cask
If you want to upgrade 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 be removed.
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 look up all of the packages available for installation from the Homebrew website. Enjoy those extra tools on your favorite Linux distribution.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.
Source of Article