How can I install ruby 2.2.1 if I am on 2.2.2?

2.5k Views Asked by At

How can I install ruby 2.2.1 if I'm currently on 2.2.2 ... I need to rewind back a version because ruby 2.2.2 seems to have having some issues loading my projects in the terminal.

3

There are 3 best solutions below

10
On BEST ANSWER

RVM is a version management system that does exactly this.

https://rvm.io/

Once you install see the faqs

https://rvm.io/rvm/basics

4
On

An option for Ruby version management is rbenv. I prefer it to RVM because it's not as intrusive (it doesn't need to be loaded into your shell, it doesn't override shell commands, it doesn't manage gemsets, etc.).


In your case, to install an older Ruby version, you can do the following, once rbenv is installed:

Check for available Ruby versions:

rbenv install -l

The above should show a list of all versions available (in your scenario, 2.2.1 should be an available option). Then once you have picked out a version you wish to install, the following command can be run next:

rbenv install 2.2.1

Finally, To switch between ruby versions you can run:

rbenv local 2.2.1

Or to set Ruby 2.2.1 to be default globally:

rbenv global 2.2.1

More info, such as installation instructions, can be found in the README

Hope that was helpful to you!

0
On

An another option for Ruby version management is chruby.