Hello, my friends. In this post, you will learn how to install Homebrew on Debian 11. 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.
What is Homebrew?
According to the project’s website
Homebrew is The Missing Package Manager for macOS (or Linux)
Homebrew installs packages to their own directory and then symlinks their files into /usr/local
. This means that we don’t have to use sudo
or have root privileges to be able to install certain applications from their large catalog.
For example, thanks to Homebrew we will be able to get recent versions of curl
or wget
because the application downloads, compiles, and installs from source code using formulas
which are scripts made in Ruby.
The way Homebrew works is summarized in Git and Ruby, so hack away with the knowledge that you can easily revert your modifications and merge upstream updates.
Although it was intended for macOS, the fact is that we can also install it on Linux giving us the following advantages.
- You can install software to your home directory and so does not require
sudo
. - Install software not packaged by your host distribution or Install up-to-date versions of software when your host distribution is old.
- Also, you can use the same package manager to manage your macOS, Linux, and Windows systems.
So, let’s get to it.
Install Homebrew on Debian 11
Before we start, we need to make sure that the distribution is up to date to avoid problems.
Open a terminal or connect via SSH to the server and run
sudo apt update sudo apt upgrade
After that, install some necessary packages recommended by the developers.
sudo apt install build-essential procps curl file git
Then, we can install Homebrew by executing this command which downloads and executes the installation script recommended by the developers.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
At startup, the script will show everything it will do on the system. If we agree we can start the process.
Then it will start the whole process of downloading, installing, and configuring Homebrew. In the end, if everything went well, you will see the following output
The only caveat is that the folder where Homebrew will save the binaries is not in the path. To fix this, run each of these commands.
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
To check that everything went well install the hello
package that will serve as a test
brew install hello
And run it
hello
So, Homebrew is ready for battle.
Conclusion
Homebrew is a tool that does not replace APT but helps us to get other packages quickly and stably. It can be useful for those sysadmins that require some useful packages that are present in Homebrew formulas.
Enjoy it.
thanks for the help much appreciated
At picture 3, instead of Installation succesfull it show me the following:
Downloading and installing Homebrew…
Updating files: 100% (2892/2892), done.
HEAD is now at c5731faf8 Merge pull request #13736 from Homebrew/dependabot/bundler/Library/Homebrew/tapioca-0.7.3
error: Not a valid ref: refs/remotes/origin/master
fatal: ambiguous argument ‘refs/remotes/origin/master’: unknown revision or path not in the working tree.
Use ‘–‘ to separate paths from revisions, like this:
‘git […] — […]’
Any help?
So glad i came across your websight having the newest gcc and gdb is so great and I love Brew