How to install brew on Mac OS?

To install brew on mac os run following command. Below is the list of all available commands that you can use using brew:

# Run following command to install homebrew
/usr/bin/ruby -e "$(curl -fsSL"

# Check if brew installed 
brew help

# To install new package via brew
brew install git

# To upgrade existing package
brew install git

# Unlink a package
brew unlink git

# Link a package or use current
brew link git

# Change to specific package version
brew switch git 2.5.0

# list all versions for given package
brew list --versions git

# list package information
brew info git

# remove older versions
brew cleanup git

# update brew
brew update

# check outdated packages
brew outdated

# list all packages
brew list