Installing RubyGems in Windows

user2797743 picture user2797743 · Sep 20, 2013 · Viewed 198k times · Source

I'm new to ruby. I tried to install Ruby Gems on my PC by following the steps given in the site http://rubygems.org/pages/download.

I downloaded the package from the mentioned site, changed the directory to the directory in which the setup resides, and tried to run setup using the command setup.rb in command prompt.

But I get a window pop up that says "Windows can't open this file" and prompts me to select a program to open this file.

What should I do now? Let me know if I am doing something wrong.

Answer

belgoros picture belgoros · Mar 3, 2014

To setup you Ruby development environment on Windows:

  1. Install Ruby via RubyInstaller: http://rubyinstaller.org/downloads/

  2. Check your ruby version: Start - Run - type in cmd to open a windows console

  3. Type in ruby -v
  4. You will get something like that: ruby 2.0.0p353 (2013-11-22) [i386-mingw32]

For Ruby 2.4 or later, run the extra installation at the end to install the DevelopmentKit. If you forgot to do that, run ridk install in your windows console to install it.

For earlier versions:

  1. Download and install DevelopmentKit from the same download page as Ruby Installer. Choose an ?exe file corresponding to your environment (32 bits or 64 bits and working with your version of Ruby).
  2. Follow the installation instructions for DevelopmentKit described at: https://github.com/oneclick/rubyinstaller/wiki/Development-Kit#installation-instructions. Adapt it for Windows.
  3. After installing DevelopmentKit you can install all needed gems by just running from the command prompt (windows console or terminal): gem install {gem name}. For example, to install rails, just run gem install rails.

Hope this helps.