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
- 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.
- Run the installer, which is pretty straightforward and will want to install Ruby to the root of your C: drive, in my case
- 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).
- 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
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
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:
Drop to your command prompt and run:
C:\DevKit>gem install watir
There is no Step 2
You should now have a Ruby/Watir setup on Windows 7.
Problem exists between keyboard and chair ↩