fus7na
Last Updated: February 25, 2016
·
4.171K
· zigomir
66d27fc45e4161889352fecaac19e20b

Remote visual debugging with RubyMine 4.5 / 5

This post is already outdated. For RubMine 6 you should look at this one: RubyMine 6.0 Remote Ruby SDK + debugging

I like to use Vagrant for projects I'm working on.

I always thought that using virtual machines make you do compromises at least for visual debugging. But this is not the case for developing Ruby (and Rails) applications with RubyMine.

You'll need to forward another port on your VM. If you're using Vagrant too, this is just one line of configuration inside your Vagrantfile

config.vm.forward_port 1234, 1234

Install ruby-debug-ide gem on your VM server

gem install ruby-debug-ide --pre --no-ri --no-rdoc
gem install debugger --no-ri --no-rdoc

Inside RubyMine add new run/debug configuration. Run -> Edit configurations... -> Add new configuration (+ sign) -> Ruby remote debug
Correctly set your remote root and local root folders.

Picture

To run your Rails app in debug mode on your VM you need to run it with rdebug-ide command. Beware to set correct host or just set it to 0.0.0.0 which will listen to all connections on port 1234.

rdebug-ide --port 1234 --dispatcher-port 26162 -h 0.0.0.0 -- script/rails server

When Rails app is running you can set breaking points inside RubyMine with clicking on a pane, left from line of code you want to debug. Debugger should stop execution on that line when you'll make a right request.

I haven't found any good example how to use remote debugger for Rails applications so I've written this post. I hope you find it useful.

Say Thanks
Respond

3 Responses
Add your response

2857
Photo on 08.01.2013 at 04.15

Thank you.

over 1 year ago ·
9560
C7662c9753b2d3d6f18636b054f60600

in new vagrant "config.vm.forwardport 1234, 1234" dont work
right "config.vm.network :forwarded
port, :guest => 1234, :host => 1234"

over 1 year ago ·
9987
66d27fc45e4161889352fecaac19e20b

Thanks eyechu. Also this post is already outdated, because in new RubyMine we have Remote Ruby SDK option which supports debugging out of the box.

over 1 year ago ·