Installing HomeBrew for MacOS
What is HomeBrew?
HomeBrew is a package manager for MacOS that makes it easy to install, update, and manage software packages on your Mac. It’s a command line tool, where you can find, download, and install packages with just a few commands. With Homebrew, you no longer have to manually download, configure, and install packages one by one.
How to Install HomeBrew
On your Mac keyboard, select CMD + Space Bar, this opens up your Spotlight Search window, and type Terminal, followed by selecting and opening your Terminal window.
Next, run the below command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
The overall installation process will take a few minutes. If you get a prompt asking for the sudo password just go ahead and enter. Once home-brew is installed, you need to follow the instructions to add homebrew to the system environment variable. (DO IT ONLY IF HOMEBREW FAILS TO ADD AUTOMATICALLY, JUST READ NEXT STEPS…)
Using HomeBrew
If you want to install Git, you would run the below command:
Brew install git
Once entered. Homebrew will automatically download, configure, and install git for you, without any further input from you.
HomeBrew Cask
HomeBrew Cask extends the capability of standard HomeBrew command which only downloads and installs CLI packages. With Homebrew cask you can install large binaries or GUI applications like Android studio, Firefox, and more.
For example, if you wanted to install Spotify you would run:
Brew install –cask Spotify
You can also search for any package or GUI that you wanted to install:
Brew search PACKAGE_NAME
Updating HomeBrew and Packages
One of the benefits of using a HomeBrew package manager on Mac, is that it makes it easy to keep your packages up to date. To update Homebrew itself, simply run:
Brew update
And to update all your installed packages, run:
Brew upgrade
Uninstall HomeBrew
Open terminal on your Mac and run the below command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
This will remove all of HomeBrew’s files from your system, including any installed packages. For some reason the uninstall script won’t delete all the directories created by HomeBrew and you need to manually delete them:
(user sudo rm -rf command )