• Skip to main content
  • Skip to secondary menu
  • Skip to primary sidebar
  • Skip to footer
WebSetNet

WebSetNet

Technology News

  • Technology News
    • Mobile
    • Games
  • Internet Marketing
  • System Admin
    • Windows
    • Linux
    • Mac & Apple
    • Website Scripts
      • Wordpress

Installing and Using Homebrew Package Manager on Linux

January 17, 2022 by Martin6

Homebrew, also known as Brew, is a command line package manager primarily created for macOS.

Homebrew grew quite popular among macOS users as more developers created command line tools that could be easily installed with Homebrew.

This popularity resulted in the creation of Linuxbrew, a Linux port for Homebrew. Since it is primarily Git and Ruby, and Linux and macOS are both Unix-like systems, Brew works good on both kind of operating systems.

Linuxbrew project eventually merged with Homebrew project and now you just have one Brew project called Homebrew.

Why am I calling it brew, instead of Homebrew? Because the command starts with brew. You’ll see it in detail in a later section.

Why use Homebrew package manager on Linux when you have got apt, dnf, snap etc?

I know the feeling. You already have a good package manager provided by your distribution. In addition to that, you have Snap, Flatpak and other universal package system.

Do you really need Homebrew package manager on your Linux system? The answer depends on your requirement, really.

See, apart from the distribution’s package manager and universal packages, you’ll come across situations where you need other package managers like Pip (for Python applications) and Cargo (for Rust packages).

Imagine you came across a good command line utility and want to try it. It’s repository mentions that it can be installed using brew or source code only. In such a case, having brew on your system could be helpful. After all, installing from source code in the 2020s is not fashionable (and comfortable).

In other words, you’ll have an additional option in case you come across some interesting CLI tool that provides only brew installation option.

Install Homebrew on Ubuntu and other Linux distributions

The installation is quite easy. You just have to make sure that you have got all the dependencies.

Step 1: Install dependencies

You need to have relatively newer version of gcc and glibc. You can install build-essential package on Ubuntu to get them. Apart from that, you also need to install Git, Curl and procps (used for monitoring system process).

You can install all of them together like this in Ubuntu and Debian based systems:

sudo apt-get install build-essential procps curl file git
install dependencies for homebrew linux
Iinstall dependencies for Homebrew in Ubuntu/Debian

For other distributions, please use your package manager and install these dependencies.

Step 2: Install Homebrew

You can see why you needed to install Curl. It allows you to download the installation script file in the terminal.

Just enter this command:

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

When asked for RETURN key, press enter:

installing homebrew ubuntu
Installing Homebrew on Ubuntu

At the end of the script competition, it recommends to run a few commands to add it to the PATH variable. Homebrew is actually installed in your home directory and then soft linked to the /usr/local directory.

adding homebrew to path linux
Run the suggested command under Next steps to add Homebrew to PATh variable

You can copy and paste in terminal easily. Just select the command it suggests and press Ctrl+Shift+C to copy and Ctrl+Shift+V to paste.

Alternatively, you can just copy paste this command:

echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> $HOME/.bash_profile

And then this:

eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
post installation steps for brew
Adding brew commands to the PATH

Step 3: Verify brew installation

You are almost done. Just verify that brew command is ready to run by using the brew doctor command:

brew doctor

The brew doctor command will tell you if there is any issue.

You may double verify by installing the sample hello project:

brew install hello

If you see no errors, you can enjoy the Homebrew package manager on Linux.

Using brew command for installing, removing and managing packages

Let me quickly tell you a few brew commands you can use for installing, removing and managing packages.

Since Homebrew is installed in your home directory, you do not need sudo to run it (just like Pip and Cargo).

To install a package with brew, use the install option:

brew install package_name

There is no autocompletion for the package name here. You need to know the exact package name.

To remove a brew package, you can use either remove or uninstall option. Both works the same.

brew remove package_name

You can also list the installed brew packages with this command:

brew list

You can also remove the unneeded dependencies with the autoremove option:

brew autoremove

In the next screenshot, I had only two packages installed with brew but it also shows the dependencies installed for those packages. Even after removing the package, dependencies remained. The autoremove finally removed them.

brew remove packages
Listing and removing brew apckages

There are a lot more brew command options but that is out of scope for this tutorial. You can always go through their documentation and explore it further.

Removing Homebrew from Linux

This tutorial won’t complete without adding the steps for removing Homebrew from your Linux system.

As per the steps mentioned on its GitHub repository, you have to download and run the uninstall script using this command:

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

You’ll be asked to confirm the removal by entering the Y key.

removing homebrew from linux
Removing Homebrew from Linux

When the uninstallation of Homebrew completes, it lists the files and directories it has leftover:

remaining files after homebrew removal
Remaining files after Homebrew removal

I let you remove the files and directories on your own.

Conclusion

As I explained earlier, Homebrew provides an extension to what you have already got. If you stumble upon an application that has only brew as installation method, having Homebrew installed on your Linux system will come handy.

Original Article

Related posts:

  1. Ubuntu 17.04 "Zesty Zapus" All Flavors Download Links
  2. Things to do After Installing Ubuntu 18.04
  3. Google Home tips and tricks: Master your Nest Mini, Max, Audio, Hub and Hub Max
  4. Google Home tips and tricks: Master your Mini, Max, Hub and Hub Max
  5. Linux Package Managers
  6. 50 Best Ubuntu Apps You Should Be Using Right Now
  7. Amazon Alexa Easter eggs: Over 180 funny things to ask Alexa
  8. Amazon Alexa Easter eggs: Over 180 funny things to ask Alexa
  9. Amazon Alexa Easter eggs: Over 180 funny things to ask Alexa
  10. How to Check Dependencies of a Package in Ubuntu/Debian-based Linux Distributions

Filed Under: Linux

Primary Sidebar

Trending

  • How to fix Windows Update Error 80244019
  • Windows 10 Update keeps failing with error 0x8007001f – 0x20006
  • How To Change Netflix Download Location In Windows 10
  • Troubleshoot Outlook “Not implemented” Unable to Send Email Error
  • How do I enable or disable Alt Gr key on Windows 10 keyboard
  • How To Install Android App APK on Samsung Tizen OS Device
  • 3 Ways To Open PST File Without Office Outlook In Windows 10
  • FIX: Windows Update error 0x800f0986
  • How to Retrieve Deleted Messages on Snapchat
  • Latest Samsung Galaxy Note 20 leak is a spec dump revealing key features
  • Install Android 7.0 Nougat ROM on Galaxy Core 2 SM-G355H
  • 192.168.1.1 Login, Admin Page, Username, Password | Wireless Router Settings
  • Websites to Watch Movies Online – 10+ Best Websites Without SignUp/Downloading
  • How to Backup SMS Messages on Your Android Smartphone
  • How to delete a blank page at the end of a Microsoft Word document
  • Fix: The Disc Image File Is Corrupted Error In Windows 10
  • Android 11 Custom ROM List – Unofficially Update Your Android Phone!
  • Samsung Galaxy Z Fold 3 could be scheduled for June 2021, with S Pen support

Footer

Tags

Amazon amazon prime amazon prime video Apple Application software epic games Galaxy Note 20 Galaxy S22 Plus Galaxy S22 Ultra Google Sheets headphones Huawei icloud Instagram instant gaming ip address iPhone iphone 12 iphone 13 iphone 13 pro max macOS Microsoft Microsoft Edge Mobile app office 365 outlook Pixel 6 Samsung Galaxy Samsung Galaxy Book 2 Pro 360 Samsung Galaxy Tab S8 Smartphone speedtest speed test teams tiktok Twitter vpn WhatsApp whatsapp web Windows 10 Windows 11 Changes Windows 11 Release Windows 11 Update Windows Subsystem For Android Windows 11 Xiaomi

Archives

  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org