Debugging Ruby on Windows using RubyMine

Most of the installation instructions for the ruby debugger that I found were out of date for Windows, so I thought it would be useful to document how I got it working.

  1. First, you should start with Ruby installed from the RubyInstaller. If you have any problems with getting debugging working, I would suggest installing Ruby fresh from here and trying again.
  2. Second, you need to install DevKit. Download DevKit from the RubyInstaller page, then follow the installation instructions on the Development Kit page. Their instructions are thorough, so I won’t reproduce them here. The DevKit install has changed recently and this was part of my problem getting the debugging gem installed.
  3. Install the ruby-debug-ide19 gem with the following command line.
    gem install ruby-debug-ide19 –platform=ruby
  4. You should now be able to debug in RubyMine. When I started debugging in RubyMine, it prompted to install additional debugging gems. I allowed it and they installed fine and debugging started.

    1. Set a breakpoint by clicking in the gutter where you want the breakpoint

      breakpoint

    2. Select your run/debug configuration in the toolbar and click on the Debug button

      debug

    3. Visit the page you want to debug in your browser. You should hit the breakpoint and see the callstack and the values of all the variables in scope.

      watch

    4. You should now be able to step through the code. See the RubyMine debugging documentation for more help.
  • Now if you’re like me and you just installed your dev environment, you’re gonna need a whole other gem: debugger (gem install debugger). It seems that ruby-debug19 is no longer actively supported.

  • It helped me, so thank you. Just a correction: gem install ruby-debug-ide19 -–platform=ruby

    It needs “–” instead of “-” or you get an error