Unable to debug in RubyMine 4.5 using Ruby 1.9.3

人走茶凉 提交于 2019-11-27 21:19:08
CrazyCoder

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.

To escape this problem I have this line in my Gemfile:
gem 'debugger' unless ENV["RM_INFO"]

Just to document the solution from jetbrains: Use either:

gem 'debugger', {group: [:test, :development]}.merge(ENV['RM_INFO'] ? {require: false} : {})

Or:

gem 'pry-debug', {group: [:test, :development]}.merge(ENV['RM_INFO'] ? {require: false} : {})

This makes sure that the Gemfile.lock remains unchanged, so a group with mixed RubyMine and vi/sublime/whatever can work happily, by do not requiring the gem in a RubyMine environment.

I had the same issue, and it cost me hours to get it working. Here is what finally got the debugger going (this is using RVM):

  • Quit RubyMine
  • If Ruby 1.9.3 is installed, uninstall it: rvm remove 1.9.3
  • Install Ruby 1.9.3 under RVM: rvm install 1.9.3 --with-gcc=clang - this produces the error "unsupported option '--with-libyaml'", but I haven't seen any ill effects from this yet
  • Switch to the new ruby: rvm use 1.9.3
  • List and remove all ruby-debug* gems: gem list | grep debug - gem uninstall <found gems>
  • Download linecache19 from http://rubyforge.org/frs/?group_id=8883 and install the gem, i.e.: gem install linecache19-0.5.13.gem
  • Lauch RubyMine, and run the debugger; it will inform about missing debug gems (i.e. ruby-debug-ide); let RubyMine install those.

That's when the debugger started working. See also this RubyMine support discussion: http://devnet.jetbrains.com/message/5443846#5443846

crizCraig

Finally got this working today with a huge kludge hack. I think the step that did it was

  1. sudo chmod -R 777 ~/.rvm

  2. Let RubyMine do its thing

I also made sure to uninstall every gem I had besides rake. I think reby-debug-ide, ruby-debug-base19x, linecache19, ruby_core_source, archive-tar-minitar, and columnize are the important ones. I also uninstalled rvm and reinstalled with clang. But I'd try just doing the chmod thing first. I tried changing to 766, but RubyMine didn't like it. So huge kludge hack it is. I now get lots of warnings about Insecure world but at least the debugger is working. Pretty sure the next version of RubyMine will not use the old ruby-debug-base19x, but instead the more recently edited gems at https://github.com/ruby-debug. So hopefully someone at the awesome JetBrains will fix it. Btw also tried running RubyMine with sudo mine but that didn't do the trick either.

I had some problems with the debugger. I installed Rails and set the path in configuration options to the ruby.exe in the rails installation and everything is working perfect.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!