# Rails console

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/help/ruby/2026.3/llms.txt).

> **TL;DR**
> Run a console: `Tools | Run Rails Console`  or

RubyMine allows you to run the [Rails console](https://guides.rubyonrails.org/command_line.html#rails-console)  and interact with your application without leaving the IDE. You can use [completion](auto-completing-code.html) and [navigation](navigating-through-the-source-code.html#go_to_declaration) capabilities, run the console with additional options, and so on.

![Rails console completion](https://resources.jetbrains.com/help/img/idea/2026.3/rails_console_completion.png)

Before using the Rails console, make sure that the rails gem [is installed](using-the-bundler.html#install_gems_local) for your interpreter.

## Run a console

To run the Rails console in RubyMine, perform the steps below:

Procedure:

1. Do one of the following:

* Press `Ctrl` (Windows), `Ctrl` (macOS), `Ctrl` (IntelliJ IDEA Classic (macOS)), `Ctrl` (macOS System Shortcuts), `Ctrl` (XWin), `Ctrl` (GNOME), `Ctrl` (KDE), `Ctrl` (Emacs), `Ctrl` (Sublime Text), `Ctrl` (Sublime Text (macOS)), `Ctrl` (Visual Studio), `Ctrl` (Visual Studio (macOS)), `Ctrl` (TextMate), `Ctrl` (NetBeans), `Ctrl` (Eclipse), `Ctrl` (Eclipse (macOS)) twice and type the question mark in a popup. Then, find the `rails c` command in a list and press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (TextMate), `Enter` (NetBeans), `Enter` (Eclipse), `⏎` (Eclipse (macOS)). If necessary you can pass [additional parameters](#run_console_options), for example: ``` rails c --sandbox ```

* Go to `Tools | Run Rails Console` .

2. (Optional) In the invoked dialog, select the required environment and click OK.

RubyMine will load the Rails console with the selected project interpreter.

![Rails console](https://resources.jetbrains.com/help/img/idea/2026.3/rails_console_empty.png)

Note that a console can be launched on a [remote interpreter](configuring-language-interpreter.html#add_remote_ruby_interpreter).

## Run a console with additional options

After you run the console for the first time, RubyMine creates the dedicated [run configuration](run-debug-configuration.html). If necessary, you can change the created configuration to provide additional options:  change the environment, protect the database from changing data,   and so on.  For example, to use the `--sandbox` option to run the console, perform the steps below:

Procedure:

1. Open the Run/Debug Configurations dialog in one of the following ways:

* Press `Ctrl+Shift+A` (Windows), `⌘ ⇧ A` (macOS), `⌘ ⇧ A` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ P` (macOS System Shortcuts), `Ctrl+Shift+A` (XWin), `Ctrl+Shift+A` (GNOME), `Ctrl+Shift+A` (KDE), `Escape, X` (Emacs), `Ctrl+Shift+P` (Sublime Text), `⌘ ⇧ P` (Sublime Text (macOS)), `Ctrl+Shift+A` (Visual Studio), `⌘ ⇧ A` (Visual Studio (macOS)), `Meta+Shift+A` (TextMate), `Ctrl+I` (NetBeans), `Ctrl+Shift+A` (Eclipse), `⌘ 3` (Eclipse (macOS)), start typing Edit Configurations, select it from the list, and press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (TextMate), `Enter` (NetBeans), `Enter` (Eclipse), `⏎` (Eclipse (macOS)).

* Expand the run/debug configuration selector on the main toolbar and select Edit Configurations. ![Edit run configurations](https://resources.jetbrains.com/help/img/idea/2026.3/rm_open_run_config_from_navigation_bar.png)

2. In the invoked Run/Debug Configurations dialog, select the created Rails console configuration in the Ruby Console group and specify the Console script arguments option in the following way:

```
console --sandbox
```

![Rails console: Run/Debug configuration](https://resources.jetbrains.com/help/img/idea/2026.3/rails_console_run_configuration.png)

Click OK.

You can now run this configuration and use the Rails console without changing the database.

## Run source code from the editor in a console

RubyMine allows you to run source code from the editor in the Rails console. To do this, perform the following steps:

Procedure:

1. Open the required Ruby file in the editor (if necessary, select a fragment of code to be executed).

2. In the main menu, go to `Tools | Load file/selection into IRB/Rails console`.

> **Tip:**
> [Debug in IRB/Rails console](debugging-in-console.html)

## Use a console

You can perform the following actions in a console:

Procedure:

* Execute commands

Type commands in the console and press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (TextMate), `Enter` (NetBeans), `Enter` (Eclipse), `⏎` (Eclipse (macOS)) to execute them.

* Multiline editing

Type a line of code and press `Shift+Enter` (Windows), `⇧ ⏎` (macOS), `⇧ ⏎` (IntelliJ IDEA Classic (macOS)), `⇧ ⏎` (macOS System Shortcuts), `Shift+Enter` (XWin), `Shift+Enter` (GNOME), `Shift+Enter` (KDE), `Shift+Enter` (Emacs), `Ctrl+Enter` (Sublime Text), `⌘ ⏎` (Sublime Text (macOS)), `Shift+Enter` (Visual Studio), `⇧ ⏎` (Visual Studio (macOS)), `Shift+Enter` (TextMate), `Shift+Enter` (NetBeans), `Shift+Enter` (Eclipse), `⇧ ⏎` (Eclipse (macOS)) to move the caret to the next line without executing a command.

* Complete names

Use [basic code completion](auto-completing-code.html) `Ctrl+Space` (Windows), `⌃ Space` (macOS), `⌃ Space` (IntelliJ IDEA Classic (macOS)), `⌃ Space` (macOS System Shortcuts), `Ctrl+Space` (XWin), `Ctrl+Space` (GNOME), `Ctrl+Space` (KDE), `Alt+/` (Emacs), `Ctrl+Space` (Sublime Text), `⌃ Space` (Sublime Text (macOS)), `Ctrl+Space` (Visual Studio), `⌃ Space` (Visual Studio (macOS)), `Ctrl+Space` (TextMate), `Ctrl+Space` (NetBeans), `Ctrl+Space` (Eclipse), `⌃ Space` (Eclipse (macOS)) to complete names of classes, methods, and so on.

* Navigate through history

Use the `Up` (Windows), `↑` (macOS), `↑` (IntelliJ IDEA Classic (macOS)), `↑` (macOS System Shortcuts), `Up` (XWin), `Up` (GNOME), `Up` (KDE), `Up` (Emacs), `Up` (Sublime Text), `↑` (Sublime Text (macOS)), `Up` (Visual Studio), `↑` (Visual Studio (macOS)), `Up` (TextMate), `Up` (NetBeans), `Up` (Eclipse), `↑` (Eclipse (macOS)) and `Down` (Windows), `↓` (macOS), `↓` (IntelliJ IDEA Classic (macOS)), `↓` (macOS System Shortcuts), `Down` (XWin), `Down` (GNOME), `Down` (KDE), `Down` (Emacs), `Down` (Sublime Text), `↓` (Sublime Text (macOS)), `Down` (Visual Studio), `↓` (Visual Studio (macOS)), `Down` (TextMate), `Down` (NetBeans), `Down` (Eclipse), `↓` (Eclipse (macOS)) arrow keys to scroll through the history of commands and execute the required ones.

* Navigate to source code

To [navigate](navigating-through-the-source-code.html#go_to_declaration) to the initial declaration of a symbol and symbol's type, place the caret at the desired symbol and press `Ctrl+B` (Windows), `⌘ B` (macOS), `⌘ B` (IntelliJ IDEA Classic (macOS)), `⌘ B` (macOS System Shortcuts), `Ctrl+B` (XWin), `Ctrl+B` (GNOME), `Ctrl+B` (KDE), `Ctrl+Alt+G` (Emacs), `F12` (Sublime Text), `F12` (Sublime Text (macOS)), `F12` (Visual Studio), `F12` (Visual Studio (macOS)), `Meta+B` (TextMate), `Ctrl+B` (NetBeans), `F3` (Eclipse), `F3` (Eclipse (macOS)).

![Rails console navigation](https://resources.jetbrains.com/help/img/idea/2026.3/rails_console_navigation.animated.gif)

* View quick documentation

To get [quick information](viewing-reference-information.html) for any symbol or method signature, place the caret at the desired symbol and press `Ctrl+Q` (Windows), `F1` (macOS), `⌃ J` (IntelliJ IDEA Classic (macOS)), `⌘ I` (macOS System Shortcuts), `Ctrl+Q` (XWin), `Ctrl+Q` (GNOME), `Ctrl+Q` (KDE), `Ctrl+Q` (Emacs), `Ctrl+Q` (Sublime Text), `Ctrl+Q` (Sublime Text (macOS)), `Ctrl+K, I` (Visual Studio), `⌘ K, I` (Visual Studio (macOS)), `Ctrl+Middle-Click` (TextMate), `Ctrl+Q` (NetBeans), `Alt+Middle-Click` (Eclipse), `⌥ Middle-Click` (Eclipse (macOS)).

