What You Will Need:

We’ll be installing the following software to complete our Ruby on Rails development environment:

  • Ruby 1.8.7
  • Rails 2.2
  • SQLite 3.6.10

Step 1: Installing Ruby

Installing Ruby is a pretty trivial task, thanks to the one-click installer. Unfortunately, that installer is only available for Ruby 1.8.6, and we want the latest and greatest! Nonetheless, it’s pretty simple to upgrade that 1.8.6 installation to 1.8.7.

Go ahead and download the Ruby 1.8.6 one-click installer as well as the Ruby 1.8.7 Windows Binaries. Run through the one-click installer, using the default location of C:\ruby as the installation location.

The one-click installer should add the Ruby path to your PATH environment variable. If it doesn’t you can do this within the Advanced System Settings control panel. To get to this panel, go to Control Panel > System, click Advanced System Settings, click the Environment Variables button near the bottom of the window, and prepend C:\ruby\bin; to the existing PATH variable. You can also do this through the command line: setx path “C:\ruby\bin;%PATH%”.

Step 2:

Now, to confirm that Ruby is installed and your environment variable is setup correctly, open the command line and type ruby --version. It should tell you that you are running version 1.8.6.

Step 3:

To upgrade your installation of Ruby to 1.8.7, extract the Ruby 1.8.7 Windows Binaries you downloaded and move the included files into your C:\ruby\bin directory - overwriting files of the same name. Once again, if you run ruby --version from the command line you should now be told you are running version 1.8.7.

Step 4: Installing Ruby on Rails

We can use the RubyGems package manager to install Ruby on Rails. The first thing we want to do is make sure we have the latest version of the gem repository. From the command line enter gem update --system to perform an update.

Installing Ruby on Rails is just as simple. Just typeing in the command gem install rails will pull down everything you need. Finally, we’ll want to install the Mongrel server, typing gem install mongrel from the command line will take care of that.

Step 5: Installing SQLite

Download the SQLite binaries from the SQLite website and extract them into this new bin directory. I believe you only need the sqlite-3_6_10.zip file but to be perfectly honest, I just downloaded them all and placed them within my bin directory.

Step 6:

Finally, we need to download a gem package that provides methods for Ruby to communicate with our SQLite databases. This is the part that usually catches people when setting up RoR for Windows, as the latest version of this package does not support Windows. We’ll need to download and install an older version of the package. From the command line, enter gem install --version 1.2.3 sqlite3-ruby to download and install the latest version of sqlite3-ruby that does support Windows.

Step 7: Testing

That’s all there is to it! To make sure everything worked properly, move to a clean development area within your command line. Run the following commands to build a test application and start the Mongrel server for this application:

  • rails test
  • cd test
  • ruby script/server

After a small delay you will see that the server is now running at http://127.0.0.1:3000/ and if you visit that URL you will be presented with the Welcome to Ruby screen. Be sure to click the link for more details on your development environment and ensure no errors are displayed in this area. You’re now ready to hop on the bandwagon and get your Ruby on Rails on!