Codectionary / Developer documentation / Ruby

Ruby in RubyMine

Install RubyMine, select a Ruby interpreter, create and run a script, and understand its debugger and licence choices.

An IDE for Ruby projects

RubyMine is JetBrains’ integrated development environment (IDE) for Ruby and Ruby on Rails. It combines a code editor with project navigation, completion, inspections, running and debugging tools. VS Code is a general-purpose editor that usually gains Ruby-specific features through an extension; RubyMine bundles many Ruby-focused tools. Neither editor is the Ruby language or replaces a Ruby interpreter.

RubyMine currently supports Windows, macOS and supported Linux distributions. Check JetBrains’ current system-requirements page before installing, because operating-system and hardware support changes. A Rails project is optional: an empty Ruby project is enough for your first script.

Check which licence applies to your work

JetBrains currently offers RubyMine free for eligible non-commercial use, including learning and hobby work under its terms. Commercial use generally requires a paid subscription. JetBrains also advertises free educational access for eligible students and teachers. These categories have conditions, so check the current RubyMine pricing and licence pages before choosing one; do not assume every project or person qualifies for free use.

You can learn Ruby without RubyMine. A plain editor and the local ruby command are enough for the examples in this guide.

Install RubyMine and Ruby

Download RubyMine from JetBrains. Its documentation recommends JetBrains Toolbox App for installing and updating JetBrains IDEs, though standalone installers are also documented. Choose the installer for your supported operating system and processor, then follow the installer. JetBrains bundles its own runtime for the IDE, so installing Java separately is not normally required to start RubyMine.

Install a maintained Ruby distribution separately before configuring a local project. On Windows, RubyInstaller is a common choice; on macOS or Linux, a version manager can select a project-specific Ruby. Confirm ruby --version in a terminal. RubyMine can use locally installed and some remote or managed interpreters, but an empty project does not require Rails.

System terminal — verify Ruby

ruby --version

Choose the Ruby interpreter for the project

On RubyMine’s welcome screen, choose New Project and Empty Project. Give the project a name and location, then select an installed Ruby in the Interpreter field. An interpreter is the executable that runs your code. If RubyMine detects a version manager, it may list its Rubies automatically. If it does not detect a package-manager or RubyInstaller installation, add the Ruby executable in Settings > Languages & Frameworks > Ruby.

Choose the Ruby version required by your project. A project file such as .ruby-version may help RubyMine select a matching interpreter, but you should check the displayed choice. Avoid using a different Ruby in the IDE from the one your terminal uses without understanding why; gems installed for one interpreter may not exist for another.

Create and run a Ruby script

In the Project tool window, select the project root and create a Ruby File/Class named hello.rb. Enter and save the line below. RubyMine’s official first-project tutorial shows running a script from the IDE and creating a run/debug configuration for it. You can also open RubyMine’s terminal in the project folder and run ruby hello.rb yourself.

The Run tool window displays the program’s output when the IDE starts the script. A terminal run displays it in the terminal instead. In either case, puts writes Hello, Codectionary! and a newline. A run configuration records the script and environment RubyMine should use on later runs.

hello.rb

puts "Hello, Codectionary!"

Optional RubyMine terminal command

ruby hello.rb

Use completion, inspections and debugging

RubyMine can suggest names while you type, navigate to definitions and highlight possible issues. Completion helps discover methods; inspections flag potential mistakes. Neither guarantees a program is correct, so run and test the behaviour. What is available may vary with the selected Ruby, gems and project configuration.

To debug, place a breakpoint beside a line, start the script with Debug instead of Run, and inspect variables when execution pauses. Continue or step through the next line to see how values change. The IDE’s debugger is most useful once a script has variables or a method; the one-line greeting has almost no state to inspect.

Solve common setup issues

If RubyMine reports that no interpreter is configured, select an installed Ruby in the project settings rather than just installing a syntax plugin. If the IDE runs an older Ruby, compare its interpreter path with ruby --version and the path reported by your version manager. A gem-not-found error can mean the selected interpreter has a different gem environment.

If the script cannot be found, confirm the run configuration points to hello.rb and the intended working directory. If the program runs in a terminal but not in the IDE, inspect the run configuration and interpreter instead of changing working Ruby code. For licensing or operating-system eligibility, use JetBrains’ current product and installation pages.

Syntax

puts "Hello, Codectionary!"

Examples

Run hello.rb from RubyMine

Create hello.rb in an Empty Project and run it with the configured Ruby interpreter.

puts "Hello, Codectionary!"
  1. The file contains one Ruby statement.
  2. The configured interpreter executes the file when RubyMine runs the script.
  3. puts writes Hello, Codectionary! in the Run tool window; the same command run in a terminal prints there instead.

Best practices

  • Check the interpreter selected for each project.
  • Choose a licence according to JetBrains’ current eligibility terms.
  • Use breakpoints to inspect actual values rather than trusting editor suggestions alone.

Runtime & versions

Ruby interpreter. Feature availability depends on the language and runtime version used by your project; consult the official reference below.

Ruby documentation

Specifications & further reading