Skip to content
Follow
Ubuntu Linux

How to install Homebrew on Ubuntu 24.04

Richard
Written by
Richard
Feb 13, 2025 Updated Jul 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 is installed by running a simple command in your terminal.

Homebrew acts like an app store for Linux, making it easy to install and manage programs. It originally came from macOS but now works on Linux systems too, helping you get the newest software versions.

This tool puts packages into your personal folder, typically at `/home/yourusername/.brew`. This helps prevent clashes with Ubuntu’s own software installer, called `apt`.

Developers often use Homebrew when they need newer or specific tools that aren’t easily found otherwise.

⚡ 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 easiest way to install Homebrew on Ubuntu 24.04 is with the official setup script. 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.

After completing the Homebrew installation script, you’ll be prompted to run several commands on your terminal.

These commands are crucial for setting up Homebrew on Ubuntu and configuring your system. Use the first command to establish Homebrew in your `.bashrc` profile, replacing ‘richard‘ with your actual username.

Running the command `eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"` sets up Homebrew in your `.bashrc` profile file. This command ensures Homebrew is ready to use every time you open a new terminal. Remember to replace 'richard' with your actual username in any file paths where it appears.

Run this command in your terminal to add Homebrew to your PATH. This ensures Homebrew functions correctly by setting specific environment variables (settings that tell your system how to behave).

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

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

💻Code
brew --version

Run the brew doctor utility to ensure everything was set up correctly.

💻Code
brew doctor

Before proceeding with the Git method, ensure you have Homebrew’s dependencies installed if you have `sudo` access:

You can install Homebrew on Ubuntu by using its source code directly from Git. This process involves downloading the Homebrew Git repository to your computer. Then, you set up your system so your computer can easily find and use Homebrew commands.

Download the Homebrew Git repository to your 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 your 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 makes managing software simple. You can install new programs with one command. Updating or removing installed programs is also easy. This approach handles your system's software quickly and efficiently.

💻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 your Ubuntu machine is straightforward using its special uninstall script. Download the script and run it in your terminal. The script then handles removing Homebrew and cleaning up any related files from your 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.

You’ll also want to remove the relevant line from your `.bashrc` file.

🐧Bash / Shell
sudo nano .bashrc

Finally, delete the Homebrew folder.

🐧Bash / Shell
sudo rm -rf homebrew

That should do it!

Conclusion:

In summary, installing Homebrew on Ubuntu can significantly enhance your development experience. Here are key points to remember:

  • 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 can streamline your workflows and keep your 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 *