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 rbenv install 2.2.4 rbenv global 2.2.4
If I remember correctly.
brew update brew upgrade brew install libxml2 libxslt libiconv gem install nokogiri -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib/ brew install mysql gem install mysql