Skip to content

Instantly share code, notes, and snippets.

@MelissaKaulfuss
Last active August 4, 2023 19:28
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MelissaKaulfuss/a1bed20d8c8ad847e1e20e43615ddc9f to your computer and use it in GitHub Desktop.
Save MelissaKaulfuss/a1bed20d8c8ad847e1e20e43615ddc9f to your computer and use it in GitHub Desktop.
How to install different Ruby versions with chruby

Managing Ruby Versions with chruby

So I'm always forgetting how to do this! I guess I'm only ever updating Ruby versions every now and then.

Checking out which Ruby versions chruby has access to

$ chruby will display your installed rubies and show you the version you're currently using in your shell.

   ruby-2.1.2
   ruby-2.2.1
   ruby-2.3.1
   ruby-2.3.3
   ruby-2.4.1
 * ruby-2.4.4
   ruby-2.5.0

Downloading the new Ruby

$ ruby-install ruby 2.4.5 will download the version you're after, just pass in the version number as the second argument (after ruby).

Gotchas

  • Make sure the version is installed in ~/.rubies and you can see a directory for the newly installed version
  • Restart the shell so that your new version is loaded

Switching to the desired Ruby

Switch to the version you're after once it's installed by running chruby with the version number $ chruby 2.4.5

@MelissaKaulfuss
Copy link
Author

FWIW I came across an issue where readline was out of date in the Ruby version I was on (an older version).
You sometimes need to update Rubies so that stuff with work! I just re-installed, and good to go!

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