Skip to content
Follow
Ubuntu Linux

How to install Homebrew on Ubuntu 24.04

Richard
Written by
Richard
Feb 13, 2025 Updated Aug 13, 2026 4 min read
How to install Homebrew on Ubuntu 24.04
How to install Homebrew on Ubuntu 24.04

Homebrew on Ubuntu 24.04 lets you install and manage command-line tools without messing up your main system files. Think of it as a handy app store for Linux that puts extra software inside your personal folder at /home/yourusername/.brew rather than mixing with Ubuntu’s built-in apt system.

You need this tool whenever specific programs or newer versions are missing from the standard Ubuntu software channels. Running a single installation script in your terminal sets everything up in just a few minutes.

⚡ Quick Answer

Install Homebrew on Ubuntu 24.04 by running the official installation script: `/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)”`. Follow the on-screen prompts, then add Homebrew to your PATH by running `eval “$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)”`.

Install Brew

The official setup script provides the fastest path for getting Homebrew running on Ubuntu 24.04. Copy and paste one command into your terminal. This script handles downloading and setting up Homebrew, making the process quick.

💻Code
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

When prompted during the script, hit Enter to install Homebrew to your home directory on Ubuntu.

Finishing the installation script requires executing several commands in the terminal.

These commands establish Homebrew on Ubuntu and configure the system environment. Use the first command to establish Homebrew in the `.bashrc` profile, replacing ‘richard‘ with the actual username.

Running the command `eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"` sets up Homebrew in the `.bashrc` profile file. This command ensures Homebrew is ready to use every time a new terminal opens. Replacing 'richard' with the correct username in all file paths is necessary.

Run this command in the terminal to add Homebrew to the PATH environment variable (settings that tell the system how to locate executable programs).

💻Code
(echo; echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"') >> /home/richard/.bashrc

Verifying the version number confirms a successful installation. Check Homebrew's version by running the `/home/linuxbrew/.linuxbrew/bin/brew --version` command in the terminal. This command displays the exact version installed, for example, Homebrew 4.2.2.

💻Code
brew --version

Run the brew doctor utility to ensure proper system configuration.

💻Code
brew doctor

Before proceeding with the Git method, ensure Homebrew's dependencies are installed when `sudo` access is available:

Installing Homebrew on Ubuntu can happen by using source code directly from Git. This process involves downloading the Homebrew Git repository to the computer. Configuring the system afterward ensures the command-line interface recognizes Homebrew commands.

Download the Homebrew Git repository to the Ubuntu machine by running the command below.

💻Code
git clone https://github.com/Homebrew/brew homebrew

Then, run the command below to add Homebrew into the system’s command-line environment.

💻Code
eval "$(homebrew/bin/brew shellenv)"

Check the installed Homebrew version by running the command below.

💻Code
brew --version
⚠️Warning
To finish the setup, run the command below to grant write access to the specified directory for data storage.

Homebrew on Ubuntu 24.04 streamlines software management. Installing new programs requires a single command. Updating or removing installed programs follows the same efficient pattern. This approach handles system software quickly and effectively.

💻Code
brew install package_name

For example, to install the GCC package, run the command below.

💻Code
brew install gcc

Replace install with upgrade to upgrade a package.

💻Code
brew upgrade gcc

To uninstall a package, use the uninstall option with a command similar to the one below.

💻Code
brew uninstall gcc

How to Remove Homebrew

Removing Homebrew from an Ubuntu machine requires executing a dedicated uninstall script. Download the script and run it in the terminal. The script then handles removing Homebrew and cleaning up related files from the system.

💻Code
curl -fsSL -o uninstall.sh https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh

Then, execute the script by running the command below.

🐧Bash / Shell
bash uninstall.sh

When prompted, enter y for yes.

Removing the relevant line from the `.bashrc` file is also necessary.

🐧Bash / Shell
sudo nano .bashrc

Finally, delete the Homebrew folder.

🐧Bash / Shell
sudo rm -rf homebrew

Configuration cleanup is complete.

Conclusion:

Installing Homebrew on Ubuntu significantly enhances the development experience. Review these key points for reference:

  • User-Friendly: Homebrew simplifies package management and offers a consistent user experience across macOS and Linux.
  • Installing software in your home directory prevents conflicts with system-managed packages.
  • Up-to-date Software: Access newer software versions that may not be available through the default Ubuntu package manager.
  • Flexible Installation: Provides multiple methods of installation (curl or Git) to suit your preference.
  • Simple Package Commands: Easily install, upgrade, and uninstall packages with straightforward commands.
  • Easy Uninstallation: Homebrew comes with an uninstall script, making it simple to remove when needed.

Using Homebrew streamlines workflows and keeps the system organized while providing access to a broader range of software options.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

📚 Related Tutorials

How to Install Ubuntu Linux
Ubuntu Linux How to Install Ubuntu Linux
How to Install KDE Desktop on Ubuntu 24.04
Ubuntu Linux How to Install KDE Desktop on Ubuntu 24.04
How to Install GNOME Desktop on Ubuntu 24.04
Ubuntu Linux How to Install GNOME Desktop on Ubuntu 24.04
How to Uninstall Software in Ubuntu Linux
Ubuntu Linux How to Uninstall Software in Ubuntu Linux

No comments yet — be the first to share your thoughts!

Leave a Comment

Your email address will not be published. Required fields are marked *