I had the need to handle multiple Ruby versions on my Windows PC. I was creating a new Rails app and wanted to use the latest Ruby version, but I also needed to manage apps that used older versions. Many developers use RVM, but it doesn’t work on Windows – so I needed a different solution.
I found URU and it works great for managing multiple Ruby versions.
I tried installing it by downloading the compressed file and running the executable included, but it didn’t work correctly. For some reason, it created a new directory, but the directory was empty.
So instead, I used the Scoop method – downloading Scoop and then using it to install URU.
(1) After I installed URU, I added the directory to my PATH (environmental variable) on my PC.
(2) Next, I opened a CMD window, and then specified the bin directories for each Ruby version you want o use. For example entering this on the cmd line (for each Ruby install):
uru admin add C:\ruby200\bin
(3) Then to switch between Ruby versions you enter the command, including the Ruby version (without periods):
uru 200
This will switch to Ruby 2.0.0.
You can check that you were switched by entering this command to check what version you are using:
ruby -v
The first time that I did this, I just installed the new Ruby version and I received an error telling me that my gemfile specified version 2.4.4, but I was running 2.2.1. That was weird because when I ran ‘ruby -v’, it told me I was on 2.4.4.
It turns out, I just needed to run ‘bundle install’ to install the gems that were in the app I was trying to run, but not installed for the new Ruby version yet.
For more details on URU commands, you can read this page from the wiki.