Distribution repositories are the first package source on most Linux systems, but they do not always carry the command-line tools or release cadence a developer workstation needs. Homebrew fills that gap with a user-owned package manager that installs formulae under a separate Linuxbrew prefix.
The supported Linux install uses the official Homebrew installer and the default /home/linuxbrew/.linuxbrew prefix. The installer uses sudo to create and assign that prefix, then normal brew commands run as the installing user without sudo.
A working compiler toolchain, procps, curl, file, and git are required before the installer runs. Ubuntu and Debian use APT for those prerequisite packages; other distributions need the equivalent development packages from the Homebrew on Linux requirements.
Related: Install Homebrew on WSL
$ sudo apt update
$ sudo apt install --assume-yes build-essential procps curl file git
On Fedora, CentOS Stream, RHEL, or Arch Linux, install the matching compiler, development tool, procps, curl, file, and git packages from the official Homebrew on Linux requirements.
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ==> Checking for `sudo` access (which may request your password)... ==> This script will install: /home/linuxbrew/.linuxbrew/bin/brew ##### snipped ##### ==> Installation successful!
Read the installer summary before confirming. The default Linux prefix is /home/linuxbrew/.linuxbrew, which is required for most prebuilt bottles.
$ eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
$ echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.bashrc
Use ~/.zshrc instead if zsh is the login shell.
Related: How to configure Homebrew shell environment
$ command -v brew /home/linuxbrew/.linuxbrew/bin/brew
$ brew --prefix /home/linuxbrew/.linuxbrew
An installation outside /home/linuxbrew/.linuxbrew can reduce support and force formulae to build from source instead of using prebuilt bottles.
Related: How to find a Homebrew package prefix
$ brew --version Homebrew 6.0.8
Exact version numbers change as Homebrew releases updates. Pair this check with command -v brew and brew –prefix so an older package-manager copy does not satisfy the test.
$ brew install hello ==> Fetching downloads for: hello ==> Installing hello ==> Pouring hello--2.12.3.arm64_linux.bottle.tar.gz ##### snipped #####
A successful hello install shows that Homebrew can fetch, pour, and link a Linux bottle. Dependency names and bottle architecture can differ by release and CPU.
Related: How to install a Homebrew formula
$ hello Hello, world!