RubyMine 2019.1 Help

Remote Debugging with RubyMine

With RubyMine you can debug your application using an interpreter that is located on the other computer, for example, on a web server or dedicated test machine.

Before you start

Make sure that you have SSH access to Mac computer!

Creating a project

On Windows, create a pure Ruby project, as described in the section Creating and running your first Ruby project .

In this tutorial, the project name is QuadraticEquation.

Preparing an example

Add a Ruby file to this project (Alt+Insert - Ruby Class). Then, type the following code:

class QuadraticEquation loop do p "insert first quotient" a = gets.to_f p "insert second quotient" b = gets.to_f p "insert third quotient" c = gets.to_f discriminant = b**2 - 4 * a * c square_root = Math.sqrt(discriminant) x1 = ((-b + square_root) / (2 * a)) x2 = ((-b - square_root) / (2 * a)) if discriminant > 0 square_root = Math.sqrt(discriminant) x1 = ((-b + square_root) / (2 * a)) x2 = ((-b - square_root) / (2 * a)) p "D = #{discriminant}, x1 = #{x1}, x2 = #{x2}" elsif discriminant == 0 x = (-b / (2 * a)) p "D = #{discriminant}, x1 = x2 = #{x}" else p "D = #{discriminant}, no roots" end end end

Creating a deployment configuration for a remote interpreter

Configure a remote interpreter

Click the Ruby SDK and Gems node. On this page, click Add an interpreter, and choose the remote interpreter:

rm remote interpreter choose windows

Next, in the Configure Remote Ruby Interpreter dialog box, click the SSH Credentials button. Enter the following:

  • In the field Host, type the name of the Mac computer.

  • In the field User name, type the user name of the Mac computer.

  • As the authentication type is set to Password, choose this option and enter your Mac password.

  • Type the Ruby interpreter path on Mac. Click the browse button (browseButton) next to this field, to see the contents of the Mac computer in question:

    rm choose deployment path

Now your deployment configuration is ready.

Creating a remote debug configuration

On the main menu, choose Run | Edit Configurations.... In the dialog box that opens, click Add configuration and choose Ruby Remote Debug. In the same dialog box, enter the following:

  • In the Name field, enter the configuration name. It's immaterial.

  • In the Remote host and Remote port fields, enter the name of your Mac computer and its port.

  • In the Remote root folder field, enter the path to the remote directory (on Mac).

  • In the Local port field, specify the port number equal to the one specified as dispatcher-port.

  • In the Local root folder field, specify the path to the local directory (on Windows). Click the browse button (browseButton) next to this field, to see the contents of your Windows computer.

rm remote debug config

Apply changes and close the dialog.

Launching the remote debug

It's important to launch the same script on the remote computer (on Mac). Next, on Windows, press Shift+F9 or choose Run | Debug 'MyRemote' on the main menu, and enjoy:

rm remote debugging using remote interpreter
Last modified: 8 May 2019