In your terminal type:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Note: You may have to enter your password.
If you're installation failed, follow the instructions at https://github.com/Homebrew/homebrew/wiki/installation.