The following process might not be the solution for everyone.
First of all, make sure developer command-line tools is installed.
If it is already installed, expected output should be:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Mac OS X 10.11 comes with version 2.0.0 of Ruby so this command should work.
Then we can install almost all the packages we need via homebrew.
Use the officially recommended way to manage ruby versions with rbenv.
brew install rbenv ruby-build
If I remember correctly.