# Add a Ruby module to your project

This procedure explains how to add a Ruby module to your project, enabling you to run Ruby code seamlessly within your IntelliJ IDEA environment. Following this procedure will ensure that the IDE recognizes your Ruby files, provides code insight, and allows proper execution of scripts and modules.

Before performing the procedure, do the following:

* Download and install the [Ruby distribution](https://www.jetbrains.com.cn/en-us/help/ruby/set-up-a-ruby-development-environment.html#ruby) for your platform.

* [Install and enable the Ruby plugin](ruby-plugin.html#install_plugin_from_repo).

## Add a Ruby module

Procedure: Add a Ruby module

1. Select the top-level directory in the Project tool window and click ![](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.add.svg) on the toolbar or press `Alt+Insert` (Windows), `⌘ N` (macOS), `⌃ N` (IntelliJ IDEA Classic (macOS)), `⌘ N` (macOS System Shortcuts), `Alt+Insert` (XWin), `Alt+Insert` (GNOME), `Alt+Insert` (KDE), `Alt+Insert` (Emacs), `Ctrl+N` (Sublime Text), `⌘ N` (Sublime Text (macOS)), `Alt+Insert` (NetBeans), `Ctrl+N` (Visual Studio), `⌘ N` (Visual Studio (macOS)), `Alt+Insert` (Eclipse), `⌘ N` (Eclipse (macOS)).

2. Select Module.

![Add Module to Project](https://resources.jetbrains.com.cn/help/img/idea/2026.2/add_module_to_project.png)

3. From the list on the left, select Ruby.

> **Note:**
> This option is only available with the Ruby plugin installed and enabled.

The IDE will detect and pre-select your Ruby interpreter.

4. Provide a name for the module.

5. (Optional) Select Add sample code to add a sample `hello.rb` Ruby file to the module.

6. Click the Create button to finish the procedure and close the dialog.

![Configuring a Ruby module](https://resources.jetbrains.com.cn/help/img/idea/2026.2/configure_ruby_module.png)

Procedure: Configure a Ruby interpreter for a Ruby module

You can configure a Ruby interpreter other than the one selected when creating the module .

1. In your project, go to `File | Project Structure` or press `Ctrl+Alt+Shift+S` (Windows), `⌘ ;` (macOS), `⌘ ;` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ Comma` (macOS System Shortcuts), `Ctrl+Alt+Shift+S` (XWin), `Ctrl+Alt+Shift+S` (GNOME), `Ctrl+Alt+Shift+S` (KDE), `Ctrl+Alt+Shift+S` (Emacs), `Ctrl+Alt+Shift+S` (Sublime Text), `⌘ ;` (Sublime Text (macOS)), `Ctrl+Alt+Shift+S` (NetBeans), `Ctrl+Alt+Shift+S` (Visual Studio), `⌘ ;` (Visual Studio (macOS)), `Ctrl+Alt+Shift+S` (Eclipse), `⌘ ;` (Eclipse (macOS)).

2. Navigate to Modules and select your Ruby module.

3. On the Ruby Interpreters tab, use one of the following options:

* Select one of the automatically detected interpreters you previously installed.

* [Add a local interpreter that your IDE did not detect](configuring-language-interpreter.html#add_local).

* [Add a remote interpreter](configuring-language-interpreter.html#add_remote_ruby_interpreter).

![Selecting an interpreter for a Ruby module](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ruby_module_selection.png)

4. Click OK in the invoked dialog.

