Installing Ruby For Windows – The Right Way

It’s unbelievable. There are plenty of manuals available on the Internet, but there is no right one. Installing Ruby and Rails on Windows is pain, comparing to Linux and OS X. So in this topic I’ll cover it step by step. Hope it can help you to save some time.

How to install Ruby and Rails – the right way:

1. Install Ruby with Ruby Installer. Pick your version. I use the latest one (2.0 when I’m writing this post). Pick your operating system: 32 or 64 bit. In this guide I use x64 version of Ruby installed in C:\Ruby200-x64

2. Make sure you have updated PATH variable pointing to: “C:\Ruby200-x64\bin” (without quotes). Press Win+R, type cmd, then type irb. You must have irb in your path. Type ruby -v to show ruby version.  Note: if you use Far Commander or other commanders you might need to restart this application.

3. Ruby is installed, it’s time to install gems. Before you can install gems, you need to install Development Kit. Go to Ruby Installer Downloads page. Pick development kit for your version of Ruby and operating system. Unpack development kit to C:\RubyDevKit

4. Change directory to C:\RubyDevKit with your favorite file manager (mine is Far Commander) or via cmd, and type ruby dk.rb init

5. Open config.yml file and add the following line right after “—” (triple dash)  if it’s not there already:
– c:/Ruby200-x64 (don’t copy and paste, just type dash, space and then type your path)

6. Run ruby dk.rb install . Here is the sample output:
[INFO] Updating convenience notice gem override for ‘c:/Ruby200-x64’
[INFO] Installing ‘c:/Ruby200-x64/lib/ruby/site_ruby/devkit.rb’

7. Now you can install gems. Try installing hipchat gem: gem install hipchat . If everything’s fine, you’re almost done. Try gem install rails .

8. If you still have errors installing gems, try

gem update --system

9. Now you need to update your SSL certificates. You don’t have any SSL certificates at the moment, so there is a big change that some of your gems won’t work (if they access a server by https for instance, like hipchat). Now it’s time to install these certificates. Run this script to download cacert.pem. Make sure you have added SSL_CERT_FILE variable to your environment pointing to downloaded cacert.pem.

Now you’re done! Happy coding!

TODO: powershell script to automate this job.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s