×


Homebrew, also known as Brew, is a command-line package manager primarily created for macOS. This alternative package manager is very useful to install certain programs that are not always present in Linux distributions or to get more recent versions.

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

In this context, we shall look into how to install Homebrew on Debian 11.


Steps to Install Homebrew on Debian 11 Bullseye 

1. Perform System Update

It is very important to update your system with the below commands:

$ sudo apt update
$ sudo apt upgrade

Also install curl, git and other system dependencies:

$ sudo apt install build-essential procps curl file git


2. Install Homebrew on the system

By default, Homebrew is not available on Debian 11 base repository. Now we download and executes the installation script using the following command below:

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

Next, add Homebrew to your PATH:

test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)"
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
test -r ~/.bash_profile && echo "eval "$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.bash_profile
echo "eval "$($(brew --prefix)/bin/brew shellenv)\" >> ~/.bash_profile

Then, verify brew installation:

$ brew doctor


How to test Homebrew ?

Once successfully installed, you can try to install a package with Brew. To install a package with brew, use the install option:

$ brew install package_name

To remove a brew package, you can use either the remove or uninstall option:

$ brew remove package_name

To view list the installed brew packages with this command:

$ brew list


How to Uninstall Homebrew from Debian 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 in fixing Debian Linux system issues ? We can help you. ]


Conclusion

This article covers how to install the latest version of Homebrew on Debian 11 Bullseye. 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.

To ensure everything is working correctly to use brew, we can run its command:

$ brew doctor

It may give the warning to install GCC and to remove that simply install it using brew:

$ brew install gcc

More Linux Tutorials

We create Linux HowTos and Tutorials for Sys Admins. Visit us on IbmiMedia.com

Also for Tech related tips, Visit forum.outsourcepath.com or General Technical tips on www.outsourcepath.com