Install Latest Stable Version of Ruby Using rbenv

Simple solution (directly installs latest stable version):

rbenv install $(rbenv install -l | grep -v - | tail -1)

Explanation:

rbenv install -l | grep -v - | tail -1

Filters out all versions that contain a hyphen -, which is all non-MRI versions and prerelease MRI versions. Then selects the last one, guaranteed to be the highest because ruby-build output is already sorted by version number ascending.

Leave a Comment