Installing Ruby + Watir on Windows 7: Quick Start

I recently had the experience of installing Ruby and Watir on a Windows 7 machine and found it a bit, um, less than straightforward. Here’s a recap of the steps such that in the future I can figure out how to do it again.

First: Ruby and DevKit Installers

  1. Let’s get Ruby. The best way to do this on Windows is to use the aptly-named RubyInstaller. Go to the RubyInstaller download page and grab the latest version of Ruby from the RubyInstallers section. Be sure to grab the x64 version if you’re running on a 64 bit system.
  2. Run the installer, which is pretty straightforward and will want to install Ruby to the root of your C: drive, in my case C:\Ruby200-x64
  3. In addition to Ruby, we’re going to need a set of development tools called the DevKit. You can install this from the RubyInstaller download page – it’s in the Development Kit section. Be sure to grab the appropriate version for your version of Ruby and platform. I can neither confirm nor deny that I initially installed the wrong version and burned several hours before I realized the underlying root cause (PEBKAC[1]).
  4. The DevKit installer is a bit less refined than most. You’ll want to save it to the folder where you want the tools installed, which is usually C:\DevKit. Run the installer which really just expands everything into the current folder.

Next: DevKit Configuration

  1. Drop to a command prompt, change to your DevKit directory, and run:

    C:\DevKit>ruby dk.rb init
    [INFO] found RubyInstaller v2.0.0 at C:/Ruby200-x64

    Initialization complete! Please review and modify the auto-generated ‘config.yml’ file to ensure it contains the root directories to all of the installed Rubies you want enhanced by the DevKit

  2. Finish the DevKit setup:

    C:\DevKit>ruby dk.rb install
    [INFO] Installing C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/defaults/operating_system.rb
    [INFO] Installing C:/Ruby200/lib/ruby/site_ruby/devkit.rb

And Then Watir

There’s some lightweight Watir documentation available, and substantial Watir documentation is, for better or worse, in a PDF ebook which can be downloaded here. It’s offered on a “pay what you want” basis, with $0.00 being a valid option.

The basic Watir install is pretty simple:

  1. Drop to your command prompt and run:

    C:\DevKit>gem install watir

  2. There is no Step 2

You should now have a Ruby/Watir setup on Windows 7.


  1. Problem exists between keyboard and chair  ↩

Advertisements

Chime in with your thoughts

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s