Debugging Ruby on Windows using RubyMine

2011, Jan 05    

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</code>
  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.

    </li>

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

      breakpoint </li>

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

      debug </li>

    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 </li>

    4. You should now be able to step through the code. See the RubyMine debugging documentation for more help.
    5. </ol> </ol>