How to install Brew on Ubuntu 20.04 LTS Linux | CyberNcrypt
Homebrew or brew is a popular Mac OS X package manager that can also be installed on Linux to download and install various packages. Homebrew Cask is an extension of Homebrew that enables quick installation of applications such as Google Chrome, VLC, and others.
Linuxbrew is its name on Linux. Why is Linuxbrew necessary if Ubuntu Linux already has an APT package manager with a wide variety of applications and other packages to install?
Difference between APT and Homebrew or Linuxbrew
- The primary objective of both HomeBrew and APT is the installation of various packages via the command line. However, while APT is the native and well-integrated manager of Debian-based systems, including Ubuntu, HomerBrew is a user-installable third-party package manager.
- If a user is already familiar with the brew command line on macOS and is new to Ubuntu, he or she can use brew to install programs without having to learn new command hooks. However, if you use Ubuntu or Debian, you certainly do not need to install it.
- Homebrew maintains a separate user-owned directory; therefore, it is not necessary to execute it with sudo in order to install applications.
- Whereas apt-get is typically designed to overwrite older versions, brew compiles packages and stores them in subdirectories according to their version. This means that multiple versions of a package can exist concurrently on the same machine, but only one will be symlinked into your main Homebrew hierarchy.
- APT removes or removes older packages automatically during an update, whereas Homebrew requires the user to run the brew cleanup command.
HomeBrew installation on Ubuntu 20.04 Linux
- Open the terminal and run the following commands
sudo apt update
sudo apt-get install build-essential
- For setting up LinuxBrew on Ubuntu 20.04 or 18.04, we need to install GIT on our system, here is the command for that
sudo apt install git -y
- The official website of Brew offers a pre-build script to install download and install Homebrew using the command line on any available Linux such as CentOS, RHEL, OpenSUSE, Linux Mint, Kali, MX Linux, POP!OS and others. Here is the command, just run it
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- To run the brew command after installation, we need to add it to our system path
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
- To ensure everything is working correctly to use brew, we can run its command
brew doctor
- It may give the warning to install GCC and to remove that simply install it using brew
brew install gcc
HomeBrew uninstallation from Linux
If you want to remove Homebrew, then here is the brew uninstallation script, also available on GitHub.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"