Skip to content

Instantly share code, notes, and snippets.

@zzidante
Forked from yannvery/CHRUBY_add_ruby_version.md
Created February 14, 2022 04:16
Show Gist options
  • Save zzidante/03a9cdcbcf226f166dcbb97e761f44e1 to your computer and use it in GitHub Desktop.
Save zzidante/03a9cdcbcf226f166dcbb97e761f44e1 to your computer and use it in GitHub Desktop.
CHRUBY - How to install a new ruby version

Install a new ruby version with chruby

OSX

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

chruby

5 - Add a ruby version file on project directory

echo "2.2.0" > .ruby-version

Issues

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