Install Homebrew on Ubuntu 20.04 LTS - Step by step guide ?

Homebrew is a widely used package manager in Mac systems. Additionally, you can install Homebrew on Linux and perform package management tasks such as installing and upgrading software packages. Homebrew cask provides support for quick installation of application such as VLC, Google Chrome and so much more.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related package manager configuration queries.

In this context, we shall look into the complete installation procedure of Homebrew on Ubuntu 20.04.


Steps to install Homebrew on Ubuntu Linux system 

1. Perform System Update

Start by updating the system's package lists with the below command:

$ sudo apt update


2. Install Dependencies

Once the update of the package index is complete, install the build-essential meta-package. This provides a link to several other packages that are going to be installed on your system as dependencies:

$ sudo apt install build-essential

Next, install the git version control package:

$ sudo apt install git

Great, we are all good with the dependencies, let's now proceed and install HomeBrew.


3. Download and run the Homebrew installation script

There is a prebuilt shell script that automates the installation of Homebrew. So, execute the following command to download and run the shell script:

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

The execution of the script creates a linuxbrew directory in the home directory that contains Homebrew settings, libraries, configuration files, and other crucial files.


4. Add Homebrew to your PATH

Once the command is fully executed, Some additional steps are required to add Homebrew to your PATH.

Now, run the below commands:

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

You can confirm the version of Brew installed with the below command:

$ brew --version

Next, give Homebrew a try and see if we can install some packages.


How to Confirm that Homebrew works ?

To verify that Homebrew is working as expected, run the command:

$ brew doctor

You will get confirmation that your system is ready to use brew.

Now, you can use Homebrew to install software using the syntax:

$ brew install package-name

For example, to install Python3, run the command:

$ brew install python3

When the installation of Python3 is complete, verify the version installed as follows:

$ python3 -V


How to Uninstall Homebrew from your Ubuntu Linux system ?

If you want to remove Homebrew, then here is the brew uninstallation script, also available on GitHub:

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


[Need help to install missing packages on your Ubuntu Linux system ? We can help you. ]

This article covers how to install and configure Homebrew on Ubuntu 20.04. In fact, Homebrew is one of the popular package managers for Mac OS X but can be installed on Linux as well to download and install various packages. 

Homebrew Cask extends Homebrew with support for quick installation of applications like Google Chrome, VLC, and more.


Differences between APT and Homebrew or Linuxbrew includes:

1. Both HomeBrew and APT’s main goal is the same that is the installation of various packages using the command line. However, on one hand, APT is the native and well-integrated manager of Debian-based systems including Ubuntu, HomerBrew is a third-party package manager that the user can install manually.

2. Difference in the command syntax, if a user is already familiar with the brew command line on macOS and new to Ubuntu then he or she can use it to install programs without learning new command hooks. However, if you are a user of Ubuntu or Debian, then for sure you don't need to install it.

3. Homebrew maintains a separate user-owned directory, thus no need to run it with sudo to install applications.

4. Where apt-get is generally designed to overwrite previous versions; in the brew, it compiles packages and saves them according to its version in subdirectories. This means we can have multiple versions of a package on the same machine at the same time, however, only one of them will get symlinked into your main Homebrew hierarchy.

5. APT cleanup or uninstall older packages automatically with the update, whereas, in Homebrew, a user needs to run the brew cleanup command.

Related Posts