Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
CHRUBY - How to install a new ruby version

Install a new ruby version with chruby


First of all you must update ruby-build to update definitions list.

brew update

And update ruby-build

brew upgrade ruby-build

Install a new ruby version

1 - Find a version to install

ruby-build --definitions

2 - Install a new ruby version with ruby-build

ruby-build 2.2.0 ~/.rubies/ruby-2.2.0

3 - Switch to ruby version

chruby ruby-2.2.0

4 - List availables rubies


5 - Add a ruby version file on project directory

echo "2.2.0" > .ruby-version


On Yosemite I've encountered a problem with irb and pry : when I use and accent char like é this appears like unicode \U+FFC3\U+FFA9.

To fix this, I installed readline :

brew install readline

Remove ruby install ( 2.2.2 in my case ) :

rm -rf ~/.rubies/ruby-2.2.2

Reinstall ruby 2.2.2

ruby-build 2.2.2 ~/.rubies/ruby-2.2.2

Ruby-build will automatically detect and use readline to enable UTF-8 input.

Some sources :

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment