Homebrew (brew) is a MacOS package manager and allows us to install versions of PHP and other useful tools. Linux users use different package managers.
Install Brew (homebrew)
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Make sure you follow instructions shown in your terminal after installing. This may include adding a line to your