Installing Debugger For Ruby 1.9.3 Under Windows

Ruby 1.9.3 has been out for quite some time now. While Ruby 1.8.7 is being slowly deprecated it’s still impossible to install debugger for 1.9.3 just with gem install command under Windows (actually other operating systems are also affected by this problem). In this post i’m going to walk you through how to install ruby-debug19 under Windows.

Trying To Install Debugger

First, let’s make sure we’re on the latest version of Ruby 1.9.3 by installing it from RubyInstaller. As of this writing the latest version is 1.9.3p194 as seen on the command line too:

Let’s get straight to the business and try to install ruby-debug19:

Above error is quite straightforward - DevKit is missing and needs to be installed. Just do it, because you will need it in the future for other gems too. Let’s try again after DevKit installation:

Woops, that doesn’t seem to be good. Something needs to be clearly changed here to make it compile.

Improving Installation Process

As it turns out, then ruby-debug19 needs at least linecache19-0.5.13 and ruby-debug-base19-0.11.26. Neither of these gems are currently available on rubygems for some strange reason. You can still get them from rubyforge though! Next step would be to download them into the same directory where you’re executing gem install command from:

Let’s try again:

This error seems to be a little bit cleaner but still something needs to be done.

Installing Debugger Successfully

Only component missing now is the source code for the Ruby itself. Make sure you download the exact version of source code you’re using Ruby, in my case 1.9.3p194. You can get it from the ruby-lang ftp.

When trying to install again we need to specify —with-ruby-include parameter for compilation process to know where to find the necessary header files at. Make sure that you specify a full path since it won’t work with relative one.

There you have it - ruby-debug19 is finally successfully installed and you can use it without any problems!

Wrapping Things Up

In conclusion, the following steps are needed to install ruby-debug19 for Ruby 1.9.3 under Windows:

I’m not sure as to why this process needs to be so complicated and is not just working with plain old gem install command. I’m hoping that this situation will improve in the future, but as long as it’s not then this post will hopefully help you to move from Ruby 1.8.7 to 1.9.3.