# Run Ruby scripts

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

RubyMine allows you to quickly run or debug Ruby scripts from the editor or by using the configured set of parameters - [run/debug configurations](run-debug-configuration.html). For instance, you can specify the following parameters for the Ruby run/debug configuration: script arguments, environment variables, additional command-line arguments, and so on.

In this topic we'll show you how to:

* Run a Ruby script [for the first time](#run_without_config) without a run configuration

* Run a Ruby script with a [run configuration](#run_with_config)

* Configure [additional parameters](#ruby_run_config) for running a script

## Run a script

To run a specified Ruby script (for example, `script.rb`) for the first time, choose one of the following ways:

Procedure: Run a script with Run Anything

1. 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 to invoke the [Run Anything](running-anything.html) popup.

2. Type the `ruby script.rb` command 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)).

![Run ruby script](https://resources.jetbrains.com/help/img/idea/2026.3/rm_new_project_ruby_run_any_script.png)

If necessary, you can specify the required command-line options and script arguments.

3. (Optional) To run [scratch files](scratches.html) or scripts outside the project root, hold down the `Alt` (Windows), `Alt` (macOS), `Alt` (IntelliJ IDEA Classic (macOS)), `Alt` (macOS System Shortcuts), `Alt` (XWin), `Alt` (GNOME), `Alt` (KDE), `Alt` (Emacs), `Alt` (Sublime Text), `Alt` (Sublime Text (macOS)), `Alt` (Visual Studio), `Alt` (Visual Studio (macOS)), `Alt` (TextMate), `Alt` (NetBeans), `Alt` (Eclipse), `Alt` (Eclipse (macOS)) key before running the command (in this case, the dialog title is changed to Run in Context).

Procedure: Run a currently opened script

To run a script opened in the [editor](using-code-editor.html), do one of the following:

* Press `Ctrl+Shift+F10` (Windows), `⌃ ⇧ R` (macOS), `⌃ ⇧ F10` (IntelliJ IDEA Classic (macOS)), `⌃ ⇧ R` (macOS System Shortcuts), `Ctrl+Shift+F10` (XWin), `Ctrl+Shift+F10` (GNOME), `Ctrl+Shift+F10` (KDE), `Ctrl+Shift+F10` (Emacs), `Ctrl+Shift+F10` (Sublime Text), `Ctrl+Shift+F10` (Sublime Text (macOS)), `Ctrl+Alt+F5` (Visual Studio), `⌃ ⌥ F5` (Visual Studio (macOS)), `Meta+Shift+R` (TextMate), `Alt+Shift+F6` (NetBeans), `Ctrl+Shift+F10` (Eclipse), `⌃ ⇧ R` (Eclipse (macOS)).

* Right-click a script and select Run 'script' from the context menu.

* Select `Run | Run...` `Alt+Shift+F10` (Windows), `⌃ ⌥ R` (macOS), `⌥ ⇧ F10` (IntelliJ IDEA Classic (macOS)), `⌃ ⌥ R` (macOS System Shortcuts), `Alt+Shift+F10` (XWin), `Alt+Shift+F10` (GNOME), `Alt+Shift+F10` (KDE), `Alt+Shift+F10` (Emacs), `Alt+Shift+F10` (Sublime Text), `⌃ ⌥ R` (Sublime Text (macOS)), `Ctrl+Alt+Shift+R` (Visual Studio), `⌘ ⌥ ⇧ R` (Visual Studio (macOS)), `Meta+R` (TextMate), `Alt+Shift+F10` (NetBeans), `Alt+Shift+F10` (Eclipse), `⌃ ⌥ R` (Eclipse (macOS)) from the main menu, select script 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)).

Procedure: Run a script from the Project view

To run a script from the Project view `Alt+1` (Windows), `⌘ 1` (macOS), `⌘ 1` (IntelliJ IDEA Classic (macOS)), `⌘ 1` (macOS System Shortcuts), `Alt+1` (XWin), `Alt+1` (GNOME), `Alt+1` (KDE), `Alt+1` (Emacs), `Alt+1` (Sublime Text), `⌘ 1` (Sublime Text (macOS)), `Ctrl+Alt+L` (Visual Studio), `⌘ ⌥ L` (Visual Studio (macOS)), `Meta+1` (TextMate), `Ctrl+1` (NetBeans), `Alt+1` (Eclipse), `Alt+1` (Eclipse (macOS)), choose one of the following ways:

* Select a script and press `Ctrl+Shift+F10` (Windows), `⌃ ⇧ R` (macOS), `⌃ ⇧ F10` (IntelliJ IDEA Classic (macOS)), `⌃ ⇧ R` (macOS System Shortcuts), `Ctrl+Shift+F10` (XWin), `Ctrl+Shift+F10` (GNOME), `Ctrl+Shift+F10` (KDE), `Ctrl+Shift+F10` (Emacs), `Ctrl+Shift+F10` (Sublime Text), `Ctrl+Shift+F10` (Sublime Text (macOS)), `Ctrl+Alt+F5` (Visual Studio), `⌃ ⌥ F5` (Visual Studio (macOS)), `Meta+Shift+R` (TextMate), `Alt+Shift+F6` (NetBeans), `Ctrl+Shift+F10` (Eclipse), `⌃ ⇧ R` (Eclipse (macOS)).

* Right-click a script and select Run 'script' from the context menu.

* Select a script, choose `Run | Run...` `Alt+Shift+F10` (Windows), `⌃ ⌥ R` (macOS), `⌥ ⇧ F10` (IntelliJ IDEA Classic (macOS)), `⌃ ⌥ R` (macOS System Shortcuts), `Alt+Shift+F10` (XWin), `Alt+Shift+F10` (GNOME), `Alt+Shift+F10` (KDE), `Alt+Shift+F10` (Emacs), `Alt+Shift+F10` (Sublime Text), `⌃ ⌥ R` (Sublime Text (macOS)), `Ctrl+Alt+Shift+R` (Visual Studio), `⌘ ⌥ ⇧ R` (Visual Studio (macOS)), `Meta+R` (TextMate), `Alt+Shift+F10` (NetBeans), `Alt+Shift+F10` (Eclipse), `⌃ ⌥ R` (Eclipse (macOS)) from the main menu, select script 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)).

After you've run a Ruby script, RubyMine automatically creates a special profile - a temporary [run/debug configuration](run-debug-configuration.html). You can [customize settings](#ruby_run_config) of this configuration, for example, pass command line arguments, configure environment variables, and so on. Then, you can [save](run-debug-configuration.html#save-as-permanent) the customized configuration to quickly [run this configuration](#run_with_config) in the future.

## Run a script using a run/debug configuration

You can run the Ruby script with the existing [run/debug configurations](run-debug-configuration.html) in one of the following ways:

Procedure:

* 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 to invoke the Run Anything popup. Start typing the required configuration name, 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)).

* Select the desired configuration on the toolbar and click ![Run](https://resources.jetbrains.com/help/img/idea/2026.3/app.actions.execute.svg) `Shift+F10` (Windows), `⌃ R` (macOS), `⇧ F10` (IntelliJ IDEA Classic (macOS)), `⌥ ⇧ R` (macOS System Shortcuts), `Shift+F10` (XWin), `Shift+F10` (GNOME), `Shift+F10` (KDE), `Shift+F10` (Emacs), `Shift+F10` (Sublime Text), `Shift+F10` (Sublime Text (macOS)), `Ctrl+F5` (Visual Studio), `⌃ F5` (Visual Studio (macOS)), `Meta+Ctrl+R` (TextMate), `F6` (NetBeans), `Alt+Shift+X` (Eclipse), `⌘ ⇧ F11` (Eclipse (macOS)).

* Go to `Run | Run...` `Alt+Shift+F10` (Windows), `⌃ ⌥ R` (macOS), `⌥ ⇧ F10` (IntelliJ IDEA Classic (macOS)), `⌃ ⌥ R` (macOS System Shortcuts), `Alt+Shift+F10` (XWin), `Alt+Shift+F10` (GNOME), `Alt+Shift+F10` (KDE), `Alt+Shift+F10` (Emacs), `Alt+Shift+F10` (Sublime Text), `⌃ ⌥ R` (Sublime Text (macOS)), `Ctrl+Alt+Shift+R` (Visual Studio), `⌘ ⌥ ⇧ R` (Visual Studio (macOS)), `Meta+R` (TextMate), `Alt+Shift+F10` (NetBeans), `Alt+Shift+F10` (Eclipse), `⌃ ⌥ R` (Eclipse (macOS)) and select the desired configuration 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)).

> **Tip:**
> You can also use the [Services tool window](services-tool-window.html#run-configs) to manage multiple run/debug configurations at once in a dedicated tool window.

## Configure parameters for running a script

When you run a Ruby script [for the first time](#run_without_config), RubyMine automatically creates a corresponding Ruby [temporary configuration](run-debug-configuration.html#temp_config), which can be saved. If necessary, you can create the Ruby run/debug configuration [manually](run-debug-configuration.html#createExplicitly) from the predefined template.

To customize the run/debug configuration, do the following:

Procedure:

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

* Select `Run | Edit Configurations` from the main menu.

* With the [Navigation bar](guided-tour-around-the-user-interface.html#navigation-bar) visible (`View | Appearance | Navigation Bar`), choose `Edit Configurations` from the run/debug configuration selector. ![Edit run configurations](https://resources.jetbrains.com/help/img/idea/2026.3/rm_open_run_config_from_navigation_bar.png)

* Press `Alt+Shift+F10` (Windows), `⌃ ⌥ R` (macOS), `⌥ ⇧ F10` (IntelliJ IDEA Classic (macOS)), `⌃ ⌥ R` (macOS System Shortcuts), `Alt+Shift+F10` (XWin), `Alt+Shift+F10` (GNOME), `Alt+Shift+F10` (KDE), `Alt+Shift+F10` (Emacs), `Alt+Shift+F10` (Sublime Text), `⌃ ⌥ R` (Sublime Text (macOS)), `Ctrl+Alt+Shift+R` (Visual Studio), `⌘ ⌥ ⇧ R` (Visual Studio (macOS)), `Meta+R` (TextMate), `Alt+Shift+F10` (NetBeans), `Alt+Shift+F10` (Eclipse), `⌃ ⌥ R` (Eclipse (macOS)) and then press `0` (Windows), `0` (macOS), `0` (IntelliJ IDEA Classic (macOS)), `0` (macOS System Shortcuts), `0` (XWin), `0` (GNOME), `0` (KDE), `0` (Emacs), `0` (Sublime Text), `0` (Sublime Text (macOS)), `0` (Visual Studio), `0` (Visual Studio (macOS)), `0` (TextMate), `0` (NetBeans), `0` (Eclipse), `0` (Eclipse (macOS)).

2. In the opened Run/Debug Configurations dialog, select the required configuration in the Ruby group, and specify its settings.

![Run/Debug Configurations](https://resources.jetbrains.com/help/img/idea/2026.3/rm_new_project_ruby_configurations_dialog.png)

## Run/debug configuration: Ruby

### Configuration tab

| Item | Description |
| --- | --- |
| Name | In this field, specify the name of the current run/debug configuration. |
| Ruby script | Specify the fully qualified path to a Ruby script to be executed, or click ![the Browse button](https://resources.jetbrains.com/help/img/idea/2026.3/app.general.ellipsis.svg), and select the desired Ruby script in the dialog that opens.  |
| Script arguments | Specify command-line arguments that will be passed after the script's filename. These arguments will be available to your Ruby program in the global `ARGV` array. For example:        1.     Pass the following values as Script arguments: `"Jet" "Brains"`.        2.     Run the following Ruby script:       ```RUBY puts "Hello, #{ARGV.join}! I'm Ruby!" ```      A program will return `Hello, JetBrains! I'm Ruby!`.       |
| Working directory | Specify the working directory used by the running task. For example, this option is in effect when the running script loads other scripts by relative paths.  |
| Environment variables |    Specify the list of environment variables as the name-value pairs, separated with semi-colons. Alternatively, click ![the Browse button](https://resources.jetbrains.com/help/img/idea/2026.3/app.general.ellipsis.svg) to create variables and specify their values in the Environment Variables dialog.       |
| Ruby arguments |    Specify the [command-line arguments](https://ruby-doc.com/docs/ProgrammingRuby/html/rubyworld.html) to be passed to the Ruby interpreter.                 |
| Ruby interpreter | Specify the desired Ruby interpreter. You can choose the project default Ruby interpreter, or select a different one from the list of configured Ruby interpreters.  |
| Execute in the context of Rails | This option is available for scripts in Rails applications. You can enable it to run [scratch](scratches.html) or project Ruby scripts in the Rails context.     Learn more from [Debug a script in Rails context](debug-rails-runner.html).    |

