It’s no secret that it’s difficult to work with Ruby on Windows, but installing RVM (Ruby Version Manager) is a way to make it a bit easier.
First, you’ll have to install Cygwin, which basically sprinkles some Linux flavor on Windows. I recommend following the directions outlined in this blog post, with a few additions:
While checking off which packages to install (there’s a whole list on that blog, I would recommend using the search feature within the Cygwin – but don’t hit enter! that will advance the installation), also install the following packages:
Proceed as normal with the installation. When you get to the kick-off script:
it will make a settings file for you. This is where the blog post kind of stops, so pick up the instructions of the rest of the installation below.
At this point, run the kickoff script again. This will actually initiate the script that will install RVM for you.
Next, exit and reopen the cygwin terminal.
Now, run the final script to finish off the RVM installation:
Once this script finishes running, you should be able to use any and all RVM commands available. To see them all available, use the command
into the cygwin terminal, or go to https://rvm.io/ for more information.
To see what’s installed, use the command
rvm list known
and the terminal will show what rubies are available. If ruby versions have square brackets around them, they may not be installed, which means you have to tell rvm to install specific versions. Let’s say, for instance, you want to install ruby 1.9.3 on Windows for a code test you have to do. So to do that enter
rvm install 1.9.3
The installation itself will take a little while, so be patient. After it’s finished, you’re ready to go!
Side Note: If you ever get an error, something like “Requirements installation failed with status: 127.” while you are setting up, it might be that you didn’t install all necessary packages while installing cygwin. To figure out what packages you need to go back and update, simply pay attention to the first few lines of the error. You’ll see a line that says something along the lines of ‘couldn’t find packages’. It’s pretty simple to go back and update the cygwin, by the way. Re-run the setup exe file that you used with the original cygwin install, and go through like you did originally (shouldn’t have to change anything). When you get to the package selection, select the ones you are missing and re-install as normal. This should resolve the problem.