Install Ruby on Rails 7 · macOS

audience developer
level all
topic Ruby on Rails
subtopic Installation

Rails New

Create a Workspace Folder

You'll need a convenient folder to store your Rails projects. You can give it any name, such as code or projects. For this tutorial, we'll call it workspace.

Create a projects folder and move into the folder:

$ mkdir workspace
$ cd workspace

This is where you'll create your Rails applications.

Rails new

Here's how to create a simple Rails application.

$ rails new --minimal myapp

The rails new command generates the default Rails starter app. The option --minimal speeds up creation of a Rails app, leaving out many Rails "extras" that are not needed for a simple application.

We'll name the new application myapp. You can give it another name you like.

You'll do all the work of developing your application inside the myapp folder, sometimes called the project root.

For a "smoke test" to see if everything runs, move into the myapp folder and run rails -T to display a list of Rake tasks.

$ cd myapp
$ rails -T

Run the application with the Rails server command:

$ rails server

Use your web browser to visit the application at http://localhost:3000/.

Use Control-c to stop the server.

This concludes the instructions for installing Ruby and Rails. Read on for additional advice and tips.