# Create and run your first Ruby project

> **TL;DR**
> Required plugin: [Ruby](ruby-plugin.html)
>
>
>
> Completed project: [ruby_helloworld](https://github.com/rubyminedoc/ruby_helloworld)

This topic explains how to do the following in IntelliJ IDEA:

* Create your first empty application

* Create and run a Ruby file

* Create and run your first Rails application

* Add a JavaScript asset to a Rails application

* Run your Rails application with the added JavaScript asset

Before performing the procedures below, download and install the [Ruby
distribution](https://www.jetbrains.com.cn/en-us/help/ruby/set-up-a-ruby-development-environment.html#ruby) and set up your IDE.

We'll perform all procedures using IntelliJ IDEA installed on macOS.

## Create your first application

In this chapter, you will learn how to create an empty application, add a Ruby file, and run it.

Procedure: Create an empty application

1. Run IntelliJ IDEA and click New Project on the [Welcome Screen](null).

![Welcome screen](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ij_welcome_screen_empty.png)

2. In the New Project dialog, select Ruby from the list on the left pane. Then, specify the following details:

* Name: specify the project name.

* Location: specify the path to the directory in which you want to create the project. By default, the IDE creates a directory with the same name as the project.

* Create Git repository: check if you want to [create a new Git repository for your project sources](set-up-a-git-repository.html#put-existing-project-under-Git).

* Ruby Interpreter: select the required [Ruby interpreter](configuring-language-interpreter.html) installed on your system.

* Add sample code: check if you want to add a sample Ruby file to your project.

![New project dialog / Ruby](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ij_new_project_dialog_ruby.png)

3. Click Create to continue.

Procedure: Create a Ruby file

After creating a project, you will see its structure in the Project tool window on the left. To add a Ruby file, do the following:

1. Select a project root in the Project tool window and 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), `Alt+Insert` (Sublime Text), `⌘ N` (Sublime Text (macOS)), `Alt+Insert` (NetBeans), `Alt+Insert` (Visual Studio), `⌘ ⌃ N` (Visual Studio (macOS)), `Alt+Insert` (Eclipse), `⌘ N` (Eclipse (macOS)).

2. In the invoked popup, select Ruby File/Class 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` (NetBeans), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (Eclipse), `⏎` (Eclipse (macOS)).

![New Ruby Class](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ij_new_project_ruby_new_class_popup.png)

3. In the invoked popup, specify a script name (script in our case) and click OK.

![New Ruby File/Class](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_new_project_ruby_new_file_dialog.png)

4. In the editor, insert the following code:

```RUBY
puts "Please enter your name"
name = gets.chomp
puts "Hello, #{name}! I'm Ruby!"
```

Procedure: Run the Ruby script

To run the created script, do the following:

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` (NetBeans), `Ctrl` (Visual Studio), `Ctrl` (Visual Studio (macOS)), `Ctrl` (Eclipse), `Ctrl` (Eclipse (macOS)) twice and type the following command:

```CONSOLE
ruby script.rb
```

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` (NetBeans), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (Eclipse), `⏎` (Eclipse (macOS)).

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

2. In the Run tool window, type any name 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` (NetBeans), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (Eclipse), `⏎` (Eclipse (macOS)) to see a program's response.

[Video](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_new_project_ruby_run_tool_window.mp4)

