Step-1: Installing Homebrew

First, install Homebrew. Homebrew allows us to install and compile necessary software packages easily from the source.

It comes with a handy installation script:

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

Run (paste) the command above in your terminal. When it asks you to install XCode CommandLine Tools, say yes.

Once the installation is done:

$ brew update

$ brew doctor

You'll get Your system is ready to brew message on the console.