Unable to debug in RubyMine 4.5 using Ruby 1.9.3
ruby, ruby-on-rails, rubymine
Solution
UPDATE: RubyMine 6+ supports debugger gem.
Make sure to remove `gem 'debugger'` from your `Gemfile`, it's a known conflict that will break debugging from RubyMine. You need only 2 gems related to debugger, exactly as stated in my another answer linked in your question.
After removing the gem you need to ensure it's not referenced anywhere in the project. In this particular case `r_spec_runner.rb` had `require 'ruby-debug'` statement causing `cannot load such file -- ruby-debug` error when trying to run `rails console`.
Problem
My apologies for the length of the question, but I want to make it clear I am not making any stupid mistakes! So, I am struggling to get debugging working in RubyMine 4.5 using Ruby 1.9.3, my steps are as follows: Fresh (i.e. having removed all previous ruby and gem directories) install of Ruby 1.9.3, Ruby Gems, DevKit and Rails (following this guide) - that works fine. I then try to begin working with my team's ruby code. I open up the directory in RubyMine (remembering first to delete the `.idea` directory) and am prompted to run `bundle install` which I do (from console) as requested. This completes successfully. Restart RubyMine. I then ensure Ruby is working: Tools > IRB Console > `puts "test"` `#test => nil` - Works I now try the debugger (`SHIFT` + `F9`) and see the message: `The gem ruby-debug-base19x required by the debugger is currently not installed. Would you like to install it?"` I click cancel and check my Gemfile, the only ones related to debugging present are: ``` # Debugging gem 'debugger' #gem 'ruby-debug-base19', :require => false #gem 'ruby-debug19', :require => false gem 'ruby-prof', :require => false #, :git => 'git://github.com/wycats/ruby-prof.git' ``` Looks like we have debugger in favour of `ruby-debug`. Reading here, however, it seems `debugger` is not sufficient. I need to install `ruby-debug-base19x`. So, following SO, I comment out debugger from Gemfile and run ``` gem install ruby-debug-base19x --pre gem install ruby-debug-ide --pre ``` Which run fine, so I add ``` gem 'ruby-debug-base19x', '0.11.30.pre10' gem 'ruby-debug-ide', '0.4.17.beta14' ``` to my Gemfile, and run a `bundle install` from the console. Finally, i open the debugger inside RubyMine (SHIFT + F9). And `puts "test" #test => nil` works again. So i try double clicking in the gutter of my script to create a breakpoint, RubyMine pauses for a second and then i get: ``` D:\Ruby\Ruby193\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta14/bin/rdebug-ide --dispatcher-port 55451 --port 55452 -- S:/code/account_groups/script/rails console Fast Debugger (ruby-debug-ide 0.4.17.beta14, ruby-debug-base 0.11.30.pre10) listens on 127.0.0.1:55452 D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/debugger-1.1.4/lib/ruby_debug.so: warning: already initialized constant VERSION 5992: Exception in DebugThread loop: undefined method `errmsg' for #<Debugger::ControlState:0x2a2f3e8> Backtrace: D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/debugger-1.1.4/lib/ruby-debug/command.rb:160:in `errmsg' from: D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/debugger-1.1.4/lib/ruby-debug/commands/breakpoints.rb:81:in `execute' from: D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta14/lib/ruby-debug-ide/ide_processor.rb:89:in `block in process_commands' from: D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta14/lib/ruby-debug-ide/ide_processor.rb:86:in `catch' from: D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta14/lib/ruby-debug-ide/ide_processor.rb:86:in `process_commands' from: D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta14/lib/ruby-debug-ide.rb:160:in `block in start_control' Process finished with exit code 0 ``` I have also tried using a backup copy of the code and following the same steps, i also get the following error when trying to load up the debugger: ``` Uncaught exception: cannot load such file -- ruby-debug D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require' D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `block in require' D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency' D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require' S:/code/account_groups_so/lib/systematic-online/r_spec_runner.rb:5:in `<top (required)>' D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require' D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `block in require' D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency' D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require' S:/code/account_groups_so/config/environment.rb:12:in `block in <top (required)>' S:/code/account_groups_so/config/environment.rb:12:in `each' S:/code/account_groups_so/config/environment.rb:12:in `<top (required)>' D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require' D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `block in require' D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency' D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require' D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/application.rb:103:in `require_environment!' D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:40:in `<top (required)>' S:/code/account_groups_so/script/rails:6:in `require' S:/code/account_groups_so/script/rails:6:in `<top (required)>' ``` There is nothing wrong with the script (i have used it fine before) and the trace seems related to `ruby-debug-ide` - what's going on? Thanks for any help - this is driving me mad!