# Run Rake tasks

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

> **TL;DR**
> Run a task: `Tools | Run Rake Task`

[Rake](https://github.com/ruby/rake) is a popular task runner for Ruby and Rails applications. Rails provides a number of predefined tasks, such as tasks for database migrations and tests. You can also create [custom tasks](https://guides.rubyonrails.org/command_line.html#custom-rake-tasks) to automate specific actions: run code analysis tools, back up databases, and so on.

RubyMine provides a convenient way to run, [debug](starting-the-debugger-session.html), and reload Rake tasks. You can also use [run/debug configurations](run-debug-configuration.html) to run tasks with specific parameters: pass task arguments, specify environment variables, select a Ruby interpreter, and so on.

Procedure: Before running a Rake task

1. Make sure the `rake` gem [is installed](using-the-bundler.html) to the project interpreter.

2. Check that the `Rakefile` is located in the project's root.

## Run a task

RubyMine allows you to run an arbitrary Rake task. For example, let’s see how to run the db:migrate task required for migrating a database in a Rails application.

Procedure: Run a task using Run Anything or the Rake Tasks popup

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 start typing db:migrate in the invoked popup. Select rake db:migrate 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)). ![Run Anything / rake db:migrate](https://resources.jetbrains.com/help/img/idea/2026.3/ij_ruby_run_any_db_migrate.png)

* Go to `Tools | Run Rake Task`. In the invoked popup, start typing db:migrate, select db:migrate, 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)).

> **Note: Important**
> In modern Rails versions, some commands that were previously available as Rake tasks, for example `routes`, are now part of the Rails command interface and are invoked using `rails <command>`.
>
>
>
> Such commands are not listed in the Rake Tasks or Run Anything popup. To run them, use a [Rails run/debug configuration](#rake_run_config) or the terminal. For example, to run `rails routes`, create a Rails run/debug configuration and specify `routes` as the command.

2. In the invoked Execute 'db:migrate' dialog, select the required migration version and environment. Click OK.

![Execute db:migrate](https://resources.jetbrains.com/help/img/idea/2026.3/ij_ruby_execute_db_migrate_dialog.png)

> **Tip:**
> Note that for other types of Rake tasks RubyMine provides the Arguments [option](#rake_run_config) for specifying the arguments to be passed to the task.

Procedure: Run a task from the editor

1. In a `*.rake` file, do one of the following:

* Click the Run Rake Task button in the gutter next to the required task.

* Place the caret at the required task name and press `Alt+Enter` (Windows), `⌥ ⏎` (macOS), `⌥ ⏎` (IntelliJ IDEA Classic (macOS)), `⌥ ⏎` (macOS System Shortcuts), `Alt+Enter` (XWin), `Alt+Enter` (GNOME), `Alt+Enter` (KDE), `Alt+Enter` (Emacs), `Alt+Enter` (Sublime Text), `⌥ ⏎` (Sublime Text (macOS)), `Alt+Enter` (Visual Studio), `⌥ ⏎` (Visual Studio (macOS)), `Alt+Enter` (TextMate), `Alt+Enter` (NetBeans), `Ctrl+1` (Eclipse), `⌘ 1` (Eclipse (macOS)).

2. Depending on whether you want to run or debug a task, select `Run '<task name>'` or `Debug '<task name>'`. 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 Rake task, RubyMine automatically creates a temporary [run/debug configuration](run-debug-configuration.html). You can [customize this configuration](#rake_run_config) to control how the task is executed: pass task arguments, specify environment variables, select a working directory, and so on. Then, you can [save](run-debug-configuration.html#save-as-permanent) the customized configuration to quickly [run it](#run_with_config) in the future.

## Run a task using a run/debug configuration

RubyMine automatically creates Rake [run configurations](run-debug-configuration.html) for running the Minitest and RSpec tests in Rails applications: test and spec. You can run these tasks or any other task with the existing run/debug configurations 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.

## Reload Rake tasks

Sometimes it is necessary to reload Rake tasks. For example, this can be useful if you created a custom task and need to run it. To reload Rake tasks, do one of the following:

Procedure:

* 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)) and start typing Reload Rake Tasks. Select this item 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)).

* Go to `Tools | Run Rake Task`. In the invoked popup, select `rake --tasks` 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)).

## Configure parameters for running a task

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

These settings do not modify the Rake task itself. They only define how RubyMine runs the task.

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 Rake group, and specify its settings.

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

### Run/debug configuration: Rake

#### Configuration tab

| Item | Description |
| --- | --- |
| Name | In this field, specify the name of the current run/debug configuration. |
| Task name |     Specify the name of the Rake task to be executed. Note that you can use [autocompletion](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 see the available tasks.      > **Note:** > If you don't see the desired Rake task in the dropdown, try reloading tasks.    |
| Arguments |     Specify [arguments](https://ruby.github.io/rake/doc/rakefile_rdoc.html#label-Tasks+with+Arguments) to be passed to the Rake task. These arguments should be separated with commas. For example:     					    1.     Create the sample Rake task as shown below:       ```RUBY task :sample, [:first, :last] do \|t, args\| puts "First name is #{args.first}" puts "Last name is #{args.last}" end ```       2.     Create the Rake run configuration and specify its settings in the following way:        * Task name: `sample`    * Arguments: `"Andrew", "Fuller"`       3.     Run the created configuration. The program will return:       ``` First name is Andrew Last name is Fuller ```       |
| Turn on invoke/execute tracing, enable full backtrace `--trace` |  Enable the `--trace` Rake [command-line option](https://ruby.github.io/rake/doc/command_line_usage_rdoc.html).  |
| Do a dry run without executing actions `-dry-run` |  Enable the `--dry-run` Rake [command-line option](https://ruby.github.io/rake/doc/command_line_usage_rdoc.html).  |
| Display the tasks and dependencies, then exit `--prereqs`  |  Enable the `--prereqs` Rake [command-line option](https://ruby.github.io/rake/doc/command_line_usage_rdoc.html).  |
| Attach test runner UI for frameworks |  Depending on the used [testing framework](testing-frameworks.html), enable the required test runner UI for [performing tests](performing-tests.html).  |
| 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.  |

