I can't get my ruby-debug-ide to work properly. I have a basic rails app, and I would like to debug in RubyMine. Before I even start RubyMine, I need to enable rdebug-ide in my vagrant VM. When I navigate to my project directory, I have read online I need to enter the following command:
rdebug-ide --port 1236 --dispatcher-port 26166 --host 0.0.0.0 - bin/rails s -b 0.0.0.0
However when I run this command, I get this message:
I have also tried a modified version of the above command: (an extra dash)
rdebug-ide --port 1236 --dispatcher-port 26166 --host 0.0.0.0 -- bin/rails s -b 0.0.0.0
And I get this as a result: This looks good at first, but then the server never starts. It never displays the server info and it just sits here and hangs until I CTRL+C out of the server. I can't get the rdebug-ide to work in conjunction with rails. Does anyone know how I can fix this?
I've got RubyMine remote debugging to work :-)
Before you start, be sure you have debase and rdebug-ide installed:
gem list | grep debase
gem list | grep ruby-debug-ide
sudo gem install debase
sudo gem install ruby-debug-ide
1. Start Rails server
First of all, you need to start the Rails server:
hello_rails$ rdebug-ide --host 0.0.0.0 --port 1234 --dispatcher-port 26162 -- bin/rails server
Fast Debugger (ruby-debug-ide 0.6.0, debase 0.2.2.beta10, file filtering is supported) listens on 0.0.0.0:1234
For your reference, my Ruby, Rails and Ubuntu versions are:
$ ruby -v
ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux-gnu]
$ rails -v
Rails 5.1.4
$ lsb_release -a
Description: Ubuntu 16.04.3 LTS
Codename: xenial
As you noticed, the server seems never starting. It just hangs there. This is actually correct. It hangs there, waiting to be connected, from RubyMine for example.
2. Remote debug from RubyMine
Now start RubyMine (I'm using RubyMine 2017.2.4), Run -> Debug... -> Edit Configurations...
Click plus sign '+' to add new configuration, and choose Ruby remote debug.
Fill the form and click the Debug button. Immediately the server does no longer hang there, and the Rails server gets started:
hello_rails$ rdebug-ide --host 0.0.0.0 --port 1234 --dispatcher-port 26162 -- bin/rails server
Fast Debugger (ruby-debug-ide 0.6.0, debase 0.2.2.beta10, file filtering is supported) listens on 0.0.0.0:1234
WARN: Unresolved specs during Gem::Specification.reset:
rake (>= 0.8.1)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
=> Booting Puma
=> Rails 5.1.4 application starting in development
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.10.0 (ruby 2.4.2-p198), codename: Russell's Teapot
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Finally, you can set breakpoints in RubyMine, and start remote debugging :-)
I believe you should add the command to the Ruby Remote Debug Configuration inside of RubyMine.
Run > Edit Configurations > Add Ruby remote debug
configuration.
来源:https://stackoverflow.com/questions/32638976/how-can-i-get-ruby-debug-ide-to-work