Installation of Ruby 2.3.1

For https://home-assistant.io/developers/website/ I need to install ruby 2.3.1. Have tried https://github.com/postmodern/ruby-install with ruby-install --system ruby 2.3.1 on Mac and it fails with the unhelpful !!! Installation of ruby 2.3.1 failed! How to install??

Tried at least 3 different ways to install but this finally worked:

brew install ruby-build
brew install rbenv
rbenv install 2.3.1