How to Install Homebrew on Debian 11 – Get Linux Package Management Magic
You’ll learn how to get the same handy “brew” command that macOS users love working on a fresh Debian 11 installation, and why you might want to bother.
What Is Homebrew and Why Use It?
Homebrew is a package manager that lets you install software from GitHub without pulling in all of apt’s dependencies. If you’ve ever wanted wget or jq installed with just one line, brew makes it painless. On Debian, the official repos can be slow to update for newer tools, so brew gives you the latest version right away.
Prerequisites You’ll Need
Before you run any commands, make sure your system is up‑to‑date and has a few build essentials:
sudo apt update && sudo apt upgrade -y sudo apt install -y curl git build-essential
curl fetches the installer script, git is needed for Homebrew’s core repository, and build-essential supplies compilers so formulae can compile if binaries aren’t available.
Run the Official Install Script
The simplest way to install brew is the one‑liner from the project:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
The script automatically pulls the latest stable release, checks its integrity, and places everything in your home directory under ~/.linuxbrew. It also prints instructions for adding brew to your PATH.
Add Homebrew to Your PATH
After the script finishes, add these lines to your shell profile (~/.bashrc, ~/.zshrc, or ~/.profile):
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
Run source ~/.bashrc (or the equivalent for your shell) so you can use brew immediately. If you forget this step, brew will silently refuse to run.
Test Your Installation
Verify everything works with:
brew doctor brew update brew install hello hello
You should see the classic “Hello, world!” output from the hello package. If you get any errors about missing libraries or conflicting packages, those usually stem from a mis‑configured PATH.
Common Gotchas on Debian 11
- I’ve seen this happen after a bad driver update: the system’s glibc was upgraded to 2.34, but Homebrew still used its bundled 2.33 libraries, causing segmentation faults in certain formulae. The fix is simply reinstall brew after the OS upgrade.
- Avoid running apt install homebrew. That package doesn’t exist and will just clutter your system with an unused wrapper.
- If you run into “Permission denied” errors while installing a formula, make sure your user owns the ~/.linuxbrew directory. Use chown -R $(whoami):$(whoami) ~/.linuxbrew.