In a terminal window execute the following code:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
In a terminal window execute the following code:
brew update
brew install postgres
brew services start postgres