How to Install and Uninstall Homebrew on Ubuntu 22.04?

Homebrew is a package manager that supports Linux as well as Mac operating systems. Homebrew is an open-source utility that provides extended functionality to manage the system’s packages (not available by default). In today’s guide, we will demonstrate the method to install and uninstall Homebrew on Ubuntu 22.04.

Let’s start with the installation first:

How to Install Homebrew on Ubuntu 22.04?

Homebrew installation files are available on the Git resource. The step-by-step installation is provided below:

Step 1: Update Packages List

The system update command is a fine approach for installing any package in Ubuntu. It achieves the latest state of system packages:

$ sudo apt update

Step 2: Install build-essential suite

To install the Homebrew, a developer tool is required, which is possible through the “build-essential” packages:

$ sudo apt install build-essential git

Step 3: Install Homebrew

To automate the installation of Homebrew in Ubuntu, a script is available in the “Github” repository. It installs multiple packages by executing the “” shell script file. The script is given below that automates the installation:

$ /bin/bash -c "$(curl -fsSL"

Press the “RETURN/ENTER” to continue the further process or press any key to stop the installation process.

Step 4: Add Homebrew to System Path

After installation of Homebrew, add the homebrew command to the system path by following the below command:

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

Now, the Homebrew is ready to use.

How to Use Homebrew on Ubuntu 22.04?

Like other package managers, Homebrew also offers methods to install and uninstall packages using Homebrew. Here, we have provided the practical implementation to install/uninstall packages using Homebrew.

Install the Package

To install any package from the Homebrew package manager, type the “brew install package_name”. In our case, the GCC package can be installed from the below command:

$ brew install gcc

Remove/Uninstall the Package

To uninstall any package, type “brew uninstall package_name” and execute in the terminal as we did here to remove GCC:

$ brew uninstall gcc

That’s how you use Homebrew on Ubuntu.

How to Uninstall Homebrew on Ubuntu 22.04?

To uninstall or remove the Homebrew package manager, the developers provide a shell script that automatically removes Homebrew with all its dependencies files. The script path is below:

$ /bin/bash -c "$(curl -fsSL"

After executing the script, it requires permission for the uninstallation process. Type the “y” to further process:

Homebrew package manager has been uninstalled, which can be verified from the above screenshot.

That’s all from this post!


In Ubuntu 22.04, the “Homebrew” package manager can be installed by executing the “” shell script from the “Github” repository. To uninstall Homebrew, the “” script can be used to remove the “Homebrew” package manager and directories. Additionally, users can specify the package name, such as “brew install [package-name]” or “brew uninstall [package-name]” to install or uninstall any package using Homebrew. This guide has provided installing and uninstalling methods of Homebrew on Ubuntu 22.04.