Learn the commands to install Homebrew on Debian 11 Bullseye to install and manage various packages via “formulas” and “casks” on your Linux.
Homebrew is an open-source project for providing a package manager to macOS because there is no default package manager, unlike Linux systems. However, the Homebrew is also present for Linux, popularly known as Linux brew.
The homebrew was started by Max Howell. In 2009 the first version of Homebrew was released. To use it the user either has to be on Linux or Mac. However, using homebrew on Linux doesn’t make sense because all of them almost come with their package manager.
Nevertheless, Homebrew does several things, it can be used to install, uninstall and update software.
At Homebrew, a distinction is made between “formulas” and “casks”. Both of these can be installed, the difference is in the details. The formulas are packages for the terminal, something like python3 or node. The so-called casks are desktop applications such as Chrome or Discord.
Install homebrew on Debian 11 Bullseye Linux
The steps given below can also be used for Debian 10 Buster as well to install Homebrew. And make sure you have at least a non-root user to set up and use this package manager.
#Using Script:
Run Apt update
Use the Apt package manager of Debian to run the system command to refresh the repository cache and update installed packages as well.
sudo apt update
Install Few required tools
If your system is minimal, then you might need to add some tools for downloading, installing, and running the Brew installation script on your Debian 11 Linux.
sudo apt install build-essential procps curl file git -y
Download script to install Homebrew on Debian 11 Linux
Next, we just need to use the curl tool to download the script and install the Homebrew package manager under your current User.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Add Brew to Debian system Path
To make sure we will be able to use the Homebrew command regardless of the directory in which we are on Terminal, run the given command to add its folder path to our system path.
(echo; echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"') >> /home/h2s/.bashrc
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
Test Brew Command
Before moving further, let’s first check whether the Brew command tool is working fine or not. Just run the Doctor command:
brew doctor
Script to Uninstall Brew from Debian 11 or 10
Well, if you didn’t like it or don’t need any more then use the below-given script to remove the brew from your Debian Linux system completely.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
sudo rm -r /home/linuxbrew/.linuxbrew
#2nd method- Directly cloning Brew repo
Clone Git Homebrew repo on Debian 11
As we already have installed the Git tool in the beginning, now use the same to clone the Brew repository on your Debian system.
git clone https://github.com/Homebrew/brew homebrew
Add the cloned folder to the system path
To use the command of brew package manager without mentioning its folder path, again and again, add it to your system path.
eval "$(homebrew/bin/brew shellenv)"
Update Brew
Next, once run the command to ensure it is up to date.
brew update --force --quiet
Set permission for it
Now, adds write permission to the directory and all its contents where brew will save the data.
chmod -R go-w "$(brew --prefix)/share/zsh"