I am experimenting with RubyMine's ability to use a "remote" Ruby sdk on a vagrant guest for all its Ruby
operations. I had already figured out performing
bundle install and
rspec commands through the RubyMine interface.
I have not figured out how to start up
rails s through RubyMine - it does not appear to have set up
my project as a "Rails" project - so there's no
test/dummy and it complains about not being able to find
This was not a problem - it is easy enough to start
rails s from the command line of the vagrant guest.
But then I wanted to debug by setting break points in the RubyMine IDE and using its debugging features.
So here are the steps I went through to accomplish that.
Edit Vagrantfile to add a new port mapping for debugger communication to the vagrant guest and restart vagrant.
config.vm.network "forwarded_port", guest: 1234, host: 61234, auto_correct: true
Edit Gemfile to add gems for debugging
gem 'ruby-debug-ide', group: [:development,:test]
gem 'debase', group: [:development,:test]
On vagrant instance, in /vagrant, run the debugger server (this accepts remote calls to execute a process)
rdebug-ide --host 0.0.0.0 --port 1234 --dispatcher-port 26162 -- bin/rails s
on host, in RubyMine
- configure a "Ruby Remote Debug" runner
- set port to 61234 - the one vagrant is mapping to the guests 1234 port
- set root folder to project root
- use your new Runner in Debug mode. This will tell the debugger server on your vagrant guest to
bin/rails s and establish communication with that rails process.
WARNING: The RubyMine "Ruby Remote Debug" dialog box provides a helpful but INCORRECT example for starting the debugger server
The BAD example command copied from RubyMine dialog box:
rdebug-ide --host 0.0.0.0--port 61234 --dispatcher-port 26162 -- $COMMAND$
It is WRONG in two ways:
- PORT is wrong - on the vagrant guest instance, you need the guest port, not the mapped host port
- SYNTAX is wrong - there must be a space before