Attaching debugger fails because gems are not loaded

I'm unable to attach the debugger to a running Rails application. When I try to attach, it fails, and I'm told that a long list of gems can't be found:

Could not find rails-, sprockets-rails-3.4.2, pg-1.2.3, puma-5.2.1...
Run `bundle install` to install missing gems.

A small dialog box opens with a link to run "bundle install". I click on it, and Bundler runs, but that doesn't solve the problem.

I can run my entire test suite from RubyMine, so I'm unsure what's up. I've spent hours trying to get this to work, but no luck.

My environment:

  • RubyMine 2022.2.1
  • MacOS 12.5.1
  • Ruby 3.0.4
  • RVM 1.29.12
  • Bundler 2.2.33
  • Rubygems 3.2.33

Digging into this a little more, when I run the test suite from inside RubyMine, the generated shell line is this:

/bin/bash -c "/Users/mjb/.rvm/bin/rvm ruby-3.0.4@gemset-name do ...

And when attaching the with debugger, it is this:

/bin/bash -c "/Users/mjb/.rvm/bin/rvm ruby-3.0.4 do ...

So, it's omitting the gemset name when it's handing the Ruby version to RVM. I don't know if that's on purpose or not. If I copy this command to the shell and include the gemset name, the Bundler error goes away.



I notice that earlier versions of RubyMine include the global gemset here, but that also has the same error.  This is from 2022.1.3:

/bin/bash -c "/Users/mjb/.rvm/bin/rvm ruby-3.0.4@global do ...

I've confirmed that I've got the correct SDK selected under "Preferences..."



If I remove my named gemset and `bundle install` into global/default then I can successfully attach the debugger to my running Rails server.

I'm glad that I have the workaround, but I'm really unhappy about that.


Hello Olga, this does look like the same issue.  I've upvoted.