# Rails/Spring support

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

[Spring](https://github.com/rails/spring) is a Rails application preloader that speeds up development by keeping your application running in the background. This means that you don’t need to restart a server when you make changes.

In RubyMine, Spring can be used to run [Rails generators](creating-rails-application-elements.html), [tests](testing-frameworks.html), and [Rake](rake.html) tasks. Make sure that the spring gem is added to the `Gemfile` and [installed](using-the-bundler.html) to the project’s interpreter.

Note that Test::Unit/Shoulda/Minitest tests are run without using Spring by default. For more information about enabling Spring for running tests, refer to [Use Spring for running tests](#enable_spring_tests).

## Use Spring for running tests

RubyMine lets you specify whether to run tests using the Spring preloader for the specified [run/debug configuration](run-debug-configuration.html). In the example below, we’ll demonstrate how to run all Minitest tests from the test directory in the [sample_rails_app](https://github.com/JetBrains/sample_rails_app) project. To do this, you can use the following workflow:

Procedure:

1. Right-click the test directory in the project view and select Run 'All tests in test: ...'. After performing tests, a corresponding run/debug configuration (All tests in test: sample_rails_app) will be created.

![run configuration for tests](https://resources.jetbrains.com/help/img/idea/2026.3/rm_run_config_temp_example.png)

2. In the navigation bar, expand the list of run/debug configurations and select Edit Configurations.

![Edit run configurations](https://resources.jetbrains.com/help/img/idea/2026.3/rm_open_run_config_from_navigation_bar.png)

3. In the invoked dialog, make sure that the All tests in test: sample_rails_app configuration is selected in the list on the left. Then, set the Use pre-load server option to Spring.

![Run/debug configurations dialog](https://resources.jetbrains.com/help/img/idea/2026.3/rm_run_config_dialog_spring.png)

Click OK. The Spring preloader will be used now to run tests from this run/debug configuration.

## Use Spring for debugging

RubyMine allows you to [debug](debugging-code.html) Rails applications with Spring. This may require updating a system or project Spring configuration file to load the debugger into every process [forked](https://github.com/rails/spring#running-code-after-forking) by Spring. When you start debugging, RubyMine might show you the dialog with the following choices:

* System config (~/.spring.rb) Click to update the system Spring config (the `~/.spring.rb` file) and start debugging.

* Project config (config/spring.rb) Click to update the project Spring config (the `config/spring.rb` file) and start debugging.

* Do not change, disable Spring Click to disable Spring for debugging an application.

## Disable Spring

If required, you can disable Spring for a current project. To do this:

Procedure:

1. In the main menu, go to `Help | Find Action` `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)).

2. Start typing Spring and disable the Spring pre-loader option.

## Spring server commands

When you launch Rails generators, tests or Rake tasks in RubyMine, it launches a separate instance of the Spring server with a custom SPRING_TMP_PATH [environment variable](https://github.com/rails/spring#environment-variables). The value of this variable is equal to ${TMPDIR}rm<hash><name>. This means that you need to prepend the Spring server commands with `SPRING_TMP_PATH=${TMPDIR}rm<hash><name>`, where:

* `<hash>` is the hash code of the project location represented in the hexadecimal system.

* `<name>` is the project name, most likely truncated.

To detect the necessary hash code and name, use the following command in the terminal:

```
ls -t ${TMPDIR} | grep "^rm"
```

You will get a list of directories starting with the `rm` prefix and sorted by the modification time (in descending order).

In the command output, find an entry that contains the first letters of the project root's folder. For example, for a project named `sample_rails_app`, the corresponding entry can look like this: `rm1c3c5678samp`. The hash code in this example is `1c3c5678` and the name is `samp`.

For example, if you encounter some issues with Spring on macOS and need to stop it, run the following command:

```
SPRING_TMP_PATH=${TMPDIR}rm1c3c5678PROJECT_NAME bin/spring stop
```

> **Note:**
> Make sure to check if you have a `bin` folder before running the command. In most cases of using Spring as a preload server in Rails applications, you should specify `bin/spring` in your commands. If there is no `bin` folder, use `spring` instead. For example:
>
>
>
>
> ```
> SPRING_TMP_PATH=${TMPDIR}rm2c4c5678PROJECT_NAME spring stop
> ```

