Linuxbrew – The Homebrew Package Manager for Linux

Linuxbrew is a clone of homebrew, the MacOS package manager, for Linux, which allows users to install software to their home directory.

It’s feature set includes:

  • Allowing installation of packages to a home directory without root access.
  • Supports installing of third-party software (not packaged on the native distributions).
  • Supports installing of up-to-date versions of packages when the one provided in the distro repositories is old.
  • In addition, brew allows you to manage packages on both your Mac and Linux machines.

In this article, we will show how to install and use Linuxbrew package manager on a Linux system.

How to Install and Use Linuxbrew in Linux

To install Linuxbrew on your Linux distribution, fist you need to install following dependencies as shown.

--------- On Debian/Ubuntu --------- 
$ sudo apt-get install build-essential curl file git

--------- On Fedora 22+ ---------
$ sudo dnf groupinstall 'Development Tools' && sudo dnf install curl file git

--------- On CentOS/RHEL ---------
$ sudo yum groupinstall 'Development Tools' && sudo yum install curl file git

Once the dependencies installed, you can use the following script to install Linuxbrew package in /home/linuxbrew/.linuxbrew (or in your home directory at ~/.linuxbrew) as shown.

$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"

Next, you need to add the directories /home/linuxbrew/.linuxbrew/bin (or ~/.linuxbrew/bin) and /home/linuxbrew/.linuxbrew/sbin (or ~/.linuxbrew/sbin) to your PATH and to your bash shell initialization script ~/.bashrc as shown.

$ echo 'export PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin/:$PATH"' >>~/.bashrc
$ echo 'export MANPATH="/home/linuxbrew/.linuxbrew/share/man:$MANPATH"' >>~/.bashrc
$ echo 'export INFOPATH="/home/linuxbrew/.linuxbrew/share/info:$INFOPATH"' >>~/.bashrc

Then source the ~/.bashrc file for the recent changes to take effect.

$ source  ~/.bashrc

Once you have successfully set up Linuxbrew on your machine, you can start using it.

For example you can install the gcc package (or formula) with the following command. Take note of some of the messages in the output, there are some useful environmental variables that you need to set for some formulae to work correctly.

$ brew install gcc
Install Package Using Linuxbrew
Install Package Using Linuxbrew

To list all installed formulae, run.

$ brew list
List Installed Formula
List Installed Formula

You can uninstall a formula using following command.

$ brew uninstall gcc

You can search for packages using the following syntax.

brew search    				#show all formulae
OR
$ brew search --desc <keyword>		#show a particular formulae

To update Linuxbrew, issue the following command which will download the newest version of homebrew from GitHub using git command line tool.

$ brew update

To know more about Linuxbrew usage options, type:

$ brew help
OR
$ man brew

How to Uninstall Linuxbrew in Linux

If you don’t want to us Linuxbrew anymore, you can uninstall it by running.

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/uninstall)"

Linuxbrew Homepage: http://linuxbrew.sh/.

That’s it for now! In this article, we have shown how to install and use Linuxbrew package manager on a Linux system. You can ask questions or send us your comments via the feedback form below.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Aaron Kili
Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

6 Comments

Leave a Reply
  1. It’s like you run a curl command in the command line to install Homebrew, you also run a ruby and curl command to uninstall Homebrew from your Mac.

    This command works on my Mac:

    ruby -e "$(curl -fsSL
    https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
    
    Reply
  2. It’s a good idea to use Linuxbrew to keep your command line tools up-to-date on an LTS distro. It’s also useful to get tools in a server where you don’t have root privilege.

    Everything has it’s pros and cons. For Linuxbrew, it’s BSD based. Secondly, the developer is very conservative about some packages, like openssl 1.0 is used in linuxbrew by default, which means curl, nghttp2 installed by linuxbrew don’t support TLS 1.3. I think openssl in most Linux distros is on branch 1.1.

    If you’re not an admin on the machine, Linuxbrew may be the best choice. If you are an admin on the machine and only wanna keep tools up-to-date. You should switch to a non-LTS distro, or a rolling distro.

    Reply
  3. I don’t get it. I already have all that I need in the Open Source communities. Why would I need anything from Apple? I guess I’m just not getting or understanding this one?….

    Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.