1. What is ‘ruby-debug-ide’?

The ‘ruby-debug-ide’ gem provides the protocol to establish communication between the debugger engine (such as debase) and IDEs (for example, RubyMine, Visual Studio Code, NetBeans or Eclipse). It redirects commands from the IDE to the debugger engine. Then, it returns answers/events received from the debugger engine to the IDE.

2. Installation:

For Ruby version 2.x, you need to install gems ruby-debug-ide and debase.

gem ‘ruby-debug-ide’, ‘0.7.3’ # An interface which glues ruby-debug to IDEs like Eclipse, NetBeans, RubyMine and Visual Studio Code.

gem ‘debase’, ‘’ # Fast implementation of the standard debugger debug.rb for Ruby.

3. For Debugging:

For a Rails application, run the following command:

rdebug-ide –host –port 1234 –dispatcher-port 1234 — bin/rails s

If you want to debug a Rails application run using Docker Compose, you need to start the Rails server from the Docker in the following way:

command: bundle exec rdebug-ide –host –port 1234 — bin/rails s -p 3000 -b
– .:/sample_rails_app
– “1234:1234”
– “3000:3000”
– “26162:26162”

Note that all ports above should be exposed in the Dockerfile.

4. Steps

  • Open the terminal from a root directory of Rails application.
  • Run the following command to start the Unicorn server to debug Rails application.

vendor/bundle/ruby/2.6.0/gems/ruby-debug-ide-0.7.3/bin/rdebug-ide –debug –host –port 1234 –dispatcher-port 3010 — vendor/bundle/ruby/2.6.0/bin/unicorn -p 3010

Now open the VSCode and add the following configuration into launch.config.

         "version": "0.2.0",
          "configurations": [
                  "name": "Start Debugging",
                  "type": "Ruby",
                  "request": "attach",
                  "remoteHost": "",
                  "remotePort": "1234", // this port will come from dispatcher port after the process started running
                  "remoteWorkspaceRoot": "${workspaceRoot}",
                  "cwd": "${workspaceRoot}",
                  "showDebuggerOutput": true,

Press F5 to start debugging. VSCode client attaches to the Unicorn that is started outside the VSCode.

Support On Demand!

Ruby on Rails