Ruby debugging using Aptana

For a long time I have been unable to use a debugger in an IDE for Ruby. I couldn’t ever get the correct gems installed into Netbeans and had just given up. Today, as a part of setting up my computer after a motherboard transplant, I have found a solution. This might be useful for others so I will post it here.

What I have now is Aptana Studio 3 with Ruby 1.9.3p551; with a working debugger!

I downloaded the following files:

The steps to install (on Windows 7) are:

  1. Run the ruby installer and tick all options.
  2. Run the DevKit application, this will unzip its contents. Choose a permanent target folder for the extracted files.
  3. Open a DOS window and change the folder to wherever the DevKit files were extracted.
  4. In the DevKit folder run ‘ruby dk.rb init’ and then ‘ruby dk.rb install’
  5. Then in the same folder (although it doesn’t matter) run ‘gem install debugger’ and then ‘gem install debugger’
  6. Exit the DOS window
  7. Run the Aptana installer allowing this to install all options.
  8. Check the debugger by doing the following.
    1. Create a Ruby project in Aptana
    2. Once the project is created Add a new file, this must have an explicit ‘.rb’ otherwise the IDE won’t treat it as a ruby source file (you’d think a new file added to a ruby project would be ruby by default).
    3. Add the following code and set a breakpoint on the puts. In the Run menu invoke Debug. The program should stop at the puts (without doing any output). Then press F6 repeatedly to execute the program within the debugger, the breakpoint will get hit once more and then the program will exit.
    a = ["aaa", "bbb"]
    a.each do |s|
       puts s

    Hope this works for you. Let me know if not.