How to use Homebrew to install software on Linux and Windows

Homebrew is available to both Linux users and Windows users thanks to Windows Subsystem for Linux, but there is an important difference in the name. On Linux systems, this application is called Linuxbrew.

For a long time, Homebrew is a useful tool, but only for Mac users. The application adds package management features in Linux style, allowing users to easily install command line utilities. Now, with version 2.0.0 or higher, this application is no longer reserved for Macs.

Homebrew is available to both Linux users and Windows users thanks to Windows Subsystem for Linux , but there is an important difference in the name. On Linux systems, this application is called Linuxbrew.

Install and use Homebrew on Linux and Windows

  1. Why use Homebrew instead of the distribution package manager?
  2. System requirements
  3. Install Linuxbrew dependencies
  4. Install Linuxbrew
  5. Use Linuxbrew

Why use Homebrew instead of the distribution package manager?

There are several reasons users want to choose to use Linuxbrew instead of the standard package manager of the system. First, users do not need to use the sudo command to install packages. Users do not even need root access to install Linuxbrew. Packages are installed in the user's home directory or home directory dedicated to Linuxbrew.

How to use Homebrew to install software on Linux and Windows Picture 1How to use Homebrew to install software on Linux and Windows Picture 1

Another reason to use Homebrew or Linuxbrew is that users can use the same package manager on different systems. In this case, there is no need to remember separate commands for Ubuntu, Mac and Windows.

System requirements

On the Linuxbrew part of Homebrew website, some system requirements are listed (most relatively modern systems will not have any problems in meeting these requirements):

  1. GCC 4.4 and above
  2. Linux 2.6.32 or higher
  3. Glibc 2.12 or higher
  4. 64-bit CPU x86_64

There is no support for 32-bit systems at this time, so if you are running an old system, unfortunately you are out of luck! There are also several dependencies to install.

Install Linuxbrew dependencies

How to use Homebrew to install software on Linux and Windows Picture 2How to use Homebrew to install software on Linux and Windows Picture 2

For Ubuntu or other Debian-based systems, users can install everything Homebrew needs to run in a single command:

 sudo apt-get install build-essential curl file git 

For Fedora, CentOS or Red Hat, use the following command:

 sudo yum groupinstall 'Development Tools' && sudo yum install curl file git 

Install Linuxbrew

As with dependencies, users can install Linuxbrew with a single command. This command downloads and runs the installation script from Linuxbrew's GitHub repository:

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

How to use Homebrew to install software on Linux and Windows Picture 3How to use Homebrew to install software on Linux and Windows Picture 3

The Linuxbrew website advises users to run the following commands to add applications to the bash profile:

 test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv) test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) test -r ~/.bash_profile && echo "eval $($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile echo "eval $($(brew --prefix)/bin/brew shellenv)" >>~/.profile 

In case the above commands do not work after logging out and returning to the shell, add the following line to '~ / .bashrc,' '~ / .zshrc,' or other related shell configuration:

 export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH 

Now, users are ready to try using Linuxbrew to install the package. The installer recommends that users install gcc, so start with:

 brew install gcc 

Use Linuxbrew

As seen above, the simplest command is brew install followed by the name of the package you want to install. To search for available packages, which Homebrew calls 'formula', users can use the brew search command followed by the package name. To display details of a particular formula, use the command to brew info followed by the name of the formula. Finally, the brew update command will update Linuxbrew as well as the installed formula.

How to use Homebrew to install software on Linux and Windows Picture 4How to use Homebrew to install software on Linux and Windows Picture 4

If installing Linuxbrew is problematic, use the brew doctor command . If all is well, the command will report ' Your system is ready to brew '. If something goes wrong, the command will tell the user where to start troubleshooting. For more commands, see the Homebrew documentation at https://docs.brew.sh/.

Wishing readers a successful implementation!

4.2 ★ | 5 Vote