How to Install Homebrew on Ubuntu
Homebrew, originally designed for macOS, is also available for Linux and offers a convenient way to install various packages. Follow these steps to install Homebrew on your Ubuntu system.
Step 1: Update Your System
First, ensure your system is up to date:
sudo apt update
Step 2: Install Prerequisites
Install the necessary developer tools and libraries:
sudo apt install build-essential procps curl file git
Step 3: Install Homebrew
Run the following command to download and install Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Step 4: Configure Homebrew
After installation, add Homebrew to your PATH and configure your shell:
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.profile
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
Step 5: Verify Installation
To confirm Homebrew is installed correctly, run:
brew --version
Step 6: Install a Package
You can now use Homebrew to install packages. For example, to install the hello
package, run:
brew install hello
Updating and Uninstalling
To update Homebrew, use:
brew update
To uninstall Homebrew, run the uninstall script:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
Additional Tips
- Use
brew doctor
to troubleshoot any issues. - Install packages using
brew install <package-name>
. - Upgrade packages with
brew upgrade <package-name>
. - Uninstall packages using
brew uninstall <package-name>
.
By following these steps, you can efficiently manage software on your Ubuntu system using Homebrew. For more detailed instructions and troubleshooting, refer to the official Homebrew documentation【18†source】【19†source】【20†source】.