The first thing you need on your mac is the package manager brew.
Installation is done like described on the page linked above, but in short it would be:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
It is useful to have an automatic update tool. I use homebrew-cask-upgrade
Installation:
brew tap buo/cask-upgrade
and then you can upgrade your brew stuff with (if you like)
brew cu