Step 1: First Install Xcode:
Step 2: Now open a Terminal and install Command Line tools and type:
xcode-select --install
Step 2a: Now open Xcode from applications and then close it...
Step 3: Now your ready to install Homebrew which makes it easy to install Ansible while your in the terminal type the following commands:
ruby -e "$(curl -fsSL https://github.com/Hawaiideveloper/HOMEBREW-Script-for-MAC/blob/master/install)"
Step 4: Next to keep the HomeBrew install quiet you need a dependency called Xquartz.
So download the package here and install it:
Step 5: Now reboot your computer and open a fresh new terminal and type:
brew install ansible