How to install ruby-debug on Windows and Ruby 1.9

Heute ein Artikel in Englisch, damit auch die internationale Gemeinde etwas davon hat ;-)

The Rails Debugging Guide told me that I have to install ruby-debug19 instead of ruby-debug when I want to debug on the Ruby 1.9 platform. So I tried to install it on a system which has Ruby 1.9.2 and Windows 7 x64 installed and I ran into trouble:

c:\Railsapps\tuneo>gem install ruby-debug19 --platform=mswin32
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing ruby-debug19:
ERROR: Failed to build gem native extension.

C:/Ruby/bin/ruby.exe extconf.rb
checking for vm_core.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
C:/Ruby/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to generate
an executable file. (RuntimeError)
You have to install development tools first.
from C:/Ruby/lib/ruby/1.9.1/mkmf.rb:452:in `try_cpp'
from C:/Ruby/lib/ruby/1.9.1/mkmf.rb:834:in `block in have_header'
from C:/Ruby/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
from C:/Ruby/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone
from C:/Ruby/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from C:/Ruby/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
from C:/Ruby/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from C:/Ruby/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
from C:/Ruby/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
from C:/Ruby/lib/ruby/1.9.1/mkmf.rb:833:in `have_header'
from extconf.rb:15:in `block in

from C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby_core_source-0.1.4/lib/ruby_co
re_source.rb:18:in `call'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby_core_source-0.1.4/lib/ruby_co
re_source.rb:18:in `create_makefile_with_core'
from extconf.rb:20:in `

Gem files will remain installed in C:/Ruby/lib/ruby/gems/1.9.1/gems/linecache19-
0.5.11 for inspection.
Results logged to C:/Ruby/lib/ruby/gems/1.9.1/gems/linecache19-0.5.11/ext/trace_

This is the way I solved it:
1. Start cmd, change to your devkit folder and execute devkitvars.bat
If you have not yet installed the devkit on your system check this Devkit on

2. Execute the gem install command:
gem install ruby-debug19 --platform=mswin32Note: the platform depends on your ruby installtion. To find out which platform you are using, check your ruby version:
c:\Railsapps>ruby -v
ruby 1.9.2p0 (2010-08-18) [i386-mingw32]

After that the ruby debugger is running on the system. Don’t wonder if the execution of the install command takes a while.