Linuxbrew – A Common Package Manager For Linux And Mac OS X

Linuxbrew - A Common Package Manager For Linux And Mac OS X

Homebrew is a free and open source package management system specially designed for Apple’s Mac OS operating system. It is written using Ruby programming language, and it comes preinstalled with Mac OS. As you might know, it is one of the open source project that both the largest number of contributors and issues closed of any project on GitHub. If you ever looking for a similar package manager like Homebrew for your Linux operating system, you should try Linuxbrew.

Linuxbrew is the fork of Homebrew. It can be used both on Mac OS and Linux. It’s usage is pretty same as Homebrew. It can be installed in your home directory and does not require root access. Like any other package manager, Linuxbrew allows you to install packages which are not packaged by the native distribution. It also allows to install most up-to-date applications and packages.

In this brief guide, we will be discussing how to install Linuxbrew in Ubuntu and CentOS, and how to use it to install, remove, and update packages.

Install Linuxbrew

Linuxbrew needs the following dependencies in your Linux box.

  • Ruby 1.8.6 or newer
  • GCC 4.4 or newer
  • Linux 2.6.16 or newer
  • 64-bit x86 or 32-bit ARM (Raspberry Pi)

Linuxbrew does not currently support 32-bit x86 platforms.

Before installing Linuxbrew, make sure the aforementioned dependencies have been installed. If they are not installed already, run the following commands to install them on your Linux system.

On Debian, Ubuntu, Linux Mint:

sudo apt-get install build-essential curl git python-setuptools ruby

On Red Hat, CentOS, Fedora:

sudo yum groupinstall 'Development Tools'
sudo yum install curl git irb python-setuptools ruby

Once you installed the prerequisites, run the following command to install Linuxbrew.

Note: Do not attempt to run the following commands as root user.

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

You should see an output something like below.

==> This script will install:
/home/sk/.linuxbrew/bin/brew
/home/sk/.linuxbrew/Library/...
/home/sk/.linuxbrew/share/doc/homebrew
/home/sk/.linuxbrew/share/man/man1/brew.1
/home/sk/.linuxbrew/share/zsh/site-functions/_brew
/home/sk/.linuxbrew/etc/bash_completion.d/brew
/home/sk/.cache/Homebrew/

Press RETURN to continue or any other key to abort
==> Downloading and installing Linuxbrew...
remote: Counting objects: 1064, done.
remote: Compressing objects: 100% (973/973), done.
remote: Total 1064 (delta 100), reused 377 (delta 52), pack-reused 0
Receiving objects: 100% (1064/1064), 1.02 MiB | 219.00 KiB/s, done.
Resolving deltas: 100% (100/100), done.
From https://github.com/Linuxbrew/brew
 * [new branch] master -> origin/master
HEAD is now at fb44951 doctor: Improve non-sticky HOMEBREW_TEMP message
Updating Homebrew...
==> Homebrew has enabled anonymous aggregate user behaviour analytics.
Read the analytics documentation (and how to opt-out) here:
 http://docs.brew.sh/Analytics.html

==> Tapping homebrew/core
Cloning into '/home/sk/.linuxbrew/Library/Taps/homebrew/homebrew-core'...
remote: Counting objects: 4146, done.
remote: Compressing objects: 100% (4021/4021), done.
remote: Total 4146 (delta 28), reused 469 (delta 10), pack-reused 0
Receiving objects: 100% (4146/4146), 3.34 MiB | 255.00 KiB/s, done.
Resolving deltas: 100% (28/28), done.
Tapped 4017 formulae (4,174 files, 10.4M)
Warning: /home/sk/.linuxbrew/bin is not in your PATH.
==> Installation successful!
==> Next steps
Install the Linuxbrew dependencies:

Debian, Ubuntu, etc.:
 `sudo apt-get install build-essential`

Fedora, Red Hat, CentOS, etc.:
 `sudo yum groupinstall 'Development Tools'`

See http://linuxbrew.sh/#dependencies for more information.

Add to your ~/.bash_profile by running
 echo 'export PATH="/home/sk/.linuxbrew/bin:$PATH"' >>~/.bash_profile
 echo 'export MANPATH="/home/sk/.linuxbrew/share/man:$MANPATH"' >>~/.bash_profile
 echo 'export INFOPATH="/home/sk/.linuxbrew/share/info:$INFOPATH"' >>~/.bash_profile

We recommend you install GCC by running `brew install gcc`.
Run `brew help` to get started
Further documentation: https://git.io/brew-docs
==> Homebrew has enabled anonymous aggregate user behaviour analytics
Read the analytics documentation (and how to opt-out) here:
 https://git.io/brew-analytics

Once you have installed Linuxbrew, add it to your PATH as shown below.

echo 'export PATH="$HOME/.linuxbrew/bin:$PATH"' >>~/.bash_profile

Reboot your system to take effect the changes.

And, install gcc which is recommended to use Linuxbrew without any issues. To do so, run:

brew install gcc

Again, you shouldn’t run this command in root login. Perform all these commands as a normal user. As you’ve seen in the commands, we haven’t used root privileges anywhere. All packages and applications will be installed in your HOME folder, so you don’t need root privileges.

Congratulations! Linuxbrew has been installed now. It’s time to explore it,

Linxubrew usage

If you have already used Homebrew, you can skip the following instructions, and start using Linuxbrew package manager right away as the way you do with Homebrew.

If you’re new to Linuxbrew, read on.

First of all, run the following command to ensure Linuxbrew is installed and working properly:

brew doctor

To update Linuxbrew itself, run:

brew update

If you are not sure what packages are available, run:

brew search

This command will display the list of available packages.

Or, you can visit braumeister site to search what packages are available.

Now, let us see how to install a package.

To install a package, for example zsh, just run:

brew install zsh

Similarly, to remove a package, run:

brew remove zsh

It’s simple as that. The one good thing I noticed while testing Linuxbrew package manager is it will show you an alternative command if a particular package is not available. Look at the following example.

brew install rsync

I got the following message. As you see in the below output, there is no available formula with the name “rsync”. So, It displayed an alternative command at the end of the output to install rsync.

Error: No available formula with the name "rsync" 
==> Searching for similarly named formulae...
These similarly named formulae were found:
grsync librsync vdirsyncer
To install one of them, run (for example):
 brew install grsync
==> Searching taps...
This formula was found in a tap:
homebrew/dupes/rsync
To install it, run:
 brew install homebrew/dupes/rsync

So, I ran the following command to install rsync:

brew install homebrew/dupes/rsync

You can search for outdated packages, using command:

brew outdated

If you want to upgrade all outdated packages, just run:

brew upgrade

To upgrade a specific package, run:

brew upgrade <package_name>

Want to view where are the downloaded packages? It’s simple.

brew --cache

Sample output would be:

/home/sk/.cache/Homebrew

Here, you can see the stuffs which are downloaded by Linuxbrew.

For more details about Linuxbrew, run:

brew help

Or,

man brew

You know now how to install and use Linuxbrew in your Linux box. The only downside is it took too long to compile and install applications. Apart from that, It just works out of the box as advertised in its website. If you’re Mac user and looking for a similar package manager like Homebrew, then Linuxbrew would be a perfect choice.

That’s all for now. I will be posting useful and interesting guides everyday. Keep visiting.

Cheers!

Reference:

Thanks for stopping by!

How can I benefit from this blog:

Have a Good day!!

You may also like...