# How to install Homebrew on Linux?

{% embed url="<https://youtu.be/x73Im92vg4w>" %}

### **Overview**

Homebrew is a package manager developed initially for macOS. It was created to simplify the process of installing and managing software. With Homebrew, you can easily install, upgrade, and remove software packages with just a few commands. You can take advantage of its community-driven development and keep your system up to date with the latest software. As a result of the tool's growing popularity and user-friendliness, Homebrew developers produced a native Linux version.

Let's see step by step how we can install Homebrew on Linux.

### **Prerequisites**

There are certain prerequisites that need to be met before you begin.&#x20;

* Linux server or operating system
* Bash shell
* GCC and related build tools
* Understanding of the Linux command line
* Non-root user with sudo privileges

### Get Started

**Step 1:** Update the package repository so the system has the latest software and security updates.

```
sudo apt-get update
```

<img src="http://customer.acecloudhosting.com/index.php?rp=/images/kb/899_image-2023-2-14_12-23-8.png" alt="" height="154" width="800">

**Step 2:** Run the following command to install essential tools and libraries.

```
sudo apt install build-essential
```

<img src="http://customer.acecloudhosting.com/index.php?rp=/images/kb/900_image-2023-2-14_12-3-5.png" alt="" height="151" width="800">

*Enter **y** to continue.*

<img src="http://customer.acecloudhosting.com/index.php?rp=/images/kb/901_image-2023-2-14_12-28-46.png" alt="" height="54" width="800">

{% hint style="info" %}
**Note**: For CentOS, Rocky Linux, and other related distributions, compiling tools package is called Development Tools.&#x20;
{% endhint %}

To install it, run the following command.

```
dnf groups mark install "Development Tools"
dnf groupinstall "Development Tools"
```

**Step 3:** Run the following command to verify if the compiler exists.

```
which make
```

**Output:**<br>

![](http://customer.acecloudhosting.com/index.php?rp=/images/kb/902_image-2023-2-14_12-43-18.png)

**Step 4:** Install Homebrew by running the following command.

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

{% hint style="info" %}
**Note:** If it asks for the password, enter the same password you set when you installed Ubuntu.
{% endhint %}

<img src="http://customer.acecloudhosting.com/index.php?rp=/images/kb/903_image-2023-2-9_11-27-48.png" alt="" height="152" width="800">

**Step 5:** To confirm, press **Enter** and wait for the installation to finish.

<img src="http://customer.acecloudhosting.com/index.php?rp=/images/kb/904_image-2023-2-9_11-36-55.png" alt="" height="155" width="800">

**Step 6:** To set up your shell environment for working with Homebrew packages, we must set the path. Run the commands appearing on your output terminal to set the Homebrew path.

```
(echo; echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"') >> /home/<username>/.profile
```

```
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
```

```
brew install gcc
```

<img src="http://customer.acecloudhosting.com/index.php?rp=/images/kb/905_image-2023-2-15_15-57-32.png" alt="" height="117" width="800">

**Step 7:** Use the command below to verify if Homebrew is installed correctly.

```
brew doctor
```

<img src="http://customer.acecloudhosting.com/index.php?rp=/images/kb/906_image-2023-2-15_17-22-44.png" alt="" height="41" width="800">

### Conclusion

After going through this guide, you should understand how to set up Homebrew on a Linux distribution.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.acecloud.ai/knowledge-base/tutorials/how-to-install-homebrew-on-linux.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
