How to Install Homebrew
Homebrew is the easiest and most flexible way to install the UNIX tools Apple didn’t include with macOS. It can also install software not packaged for your Linux distribution without requiring sudo
.
Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew
--version
brewcommand
[--verbose
|-v
] [options
] [formula
] …
Install formula
$ brew install wget
Uninstall formula
$ brew uninstall wget
Homebrew on Linux
The Homebrew package manager may be used on Linux and Windows Subsystem for Linux (WSL) 2. Homebrew was formerly referred to as Linuxbrew when running on Linux or WSL. Homebrew does not use any libraries provided by your host system, except glibc and gcc if they are new enough. Homebrew can install its own current versions of glibc and gcc for older distributions of Linux.
Requirements
- Linux 3.2 or newer
- Glibc 2.13 or newer
- 64-bit x86_64 CPU
To install build tools, paste at a terminal prompt:
Debian or Ubuntu
sudo apt-get install build-essential procps curl file git
Fedora, CentOS, or Red Hat
sudo yum groupinstall 'Development Tools'
sudo yum install procps-ng curl file git
Arch Linux
Arch Linux
Install
The installation script installs Homebrew to /home/linuxbrew/.linuxbrew
using sudo. Homebrew does not use sudo after installation. Using /home/linuxbrew/.linuxbrew
allows the use of most binary packages (bottles) which will not work when installing in e.g. your personal home directory.
Follow the Next steps instructions to add Homebrew to your PATH
and to your bash shell rcfile, either ~/.bashrc
for bash
or ~/.zshrc
for zsh
.
test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)"
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.bashrc
You’re done! Try installing a package:
brew install hello