Skip to content

Instantly share code, notes, and snippets.

@yannvery
Last active December 8, 2023 00:51
Show Gist options
  • Star 27 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save yannvery/b1cf1a7b11ac84e798a5 to your computer and use it in GitHub Desktop.
Save yannvery/b1cf1a7b11ac84e798a5 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