RubyMine 2017.3 Help

Remote Debugging with RubyMine

Introduction

What to do, if the interpreter you are going to use, is located on the other computer? Say, you are going to debug an application on Windows, but your favorite interpreter is located on Mac... With RubyMine, it's not a problem.

Before you start

Make sure that you have an SSH access to Mac computer!

Creating a project

On Windows, create a pure Ruby project, as described in the section Creating Empty 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

Using a remote interpreter

Configuring a remote interpreter on Windows

Note that any remote interpreter will do.

Click Ctrl+Alt+S to open the Settings dialog on the Windows machine (the whole process is described in the section Accessing Settings).

Click the Ruby SDK and Gems node. On this page, click /help/img/idea/2017.3/add.png, and choose the remote interpreter:

/help/img/idea/2017.3/rm_remote_interpreter_choose_windows.png

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 (/help/img/idea/2017.3/browseButton.png) next to this field, to see the contents of the Mac computer in question:
    /help/img/idea/2017.3/rm_choose_deployment_path.png

Now your remote interpreter is ready.

Creating a remote debug configuration

On the main menu, choose Run | Edit Configurations.... In the dialog box that opens, click /help/img/idea/2017.3/add.png 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 (/help/img/idea/2017.3/browseButton.png) next to this field, to see the contents of your Windows computer.
/help/img/idea/2017.3/rm_remote_debug_config.png

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:

/help/img/idea/2017.3/rm_remote_debugging_using_remote_interpreter.png
Last modified: 15 September 2017