How to Install Homebrew on Ubuntu

Sh Raj - Jul 6 - - Dev Community

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
Enter fullscreen mode Exit fullscreen mode

Step 2: Install Prerequisites

Install the necessary developer tools and libraries:

sudo apt install build-essential procps curl file git
Enter fullscreen mode Exit fullscreen mode

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)"
Enter fullscreen mode Exit fullscreen mode

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)"
Enter fullscreen mode Exit fullscreen mode

Step 5: Verify Installation

To confirm Homebrew is installed correctly, run:

brew --version
Enter fullscreen mode Exit fullscreen mode

Step 6: Install a Package

You can now use Homebrew to install packages. For example, to install the hello package, run:

brew install hello
Enter fullscreen mode Exit fullscreen mode

Updating and Uninstalling

To update Homebrew, use:

brew update
Enter fullscreen mode Exit fullscreen mode

To uninstall Homebrew, run the uninstall script:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
Enter fullscreen mode Exit fullscreen mode

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】.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .