Skip to content

Guide · Open source

How to use Ruby on Rails: install, create an app and run it

Updated · written with AI from the project's own documentation and checked against our catalogue data

Ruby on Rails is an open-source web application framework for building database-backed websites and apps in Ruby. This guide is for readers who want to install it, create a first application and start its web server. By the end you will know what the three MVC layers do and where Rails fits compared with other frameworks.

Railsrails/rails · ★ 58.8k · MIT

Quick start

  1. 1Install Rails. Run gem install rails at the command prompt if Rails is not yet installed.
  2. 2Create an app. Run rails new myapp, where myapp is your application name.
  3. 3Enter the folder. Change into the new directory with cd myapp.
  4. 4Start the server. Run bin/rails server inside the app folder.
  5. 5Open the bootscreen. Visit http://localhost:3000 in your browser to see the Rails bootscreen.
  6. 6Read the guides. Follow the Getting Started guide and the Ruby on Rails Guides to build your application.

What does Ruby on Rails include?

Rails is a web application framework that includes what is needed to create database-backed web applications using the Model-View-Controller (MVC) pattern. MVC splits an application into three layers: Model, View, and Controller, each with a specific responsibility.

  • Model: represents the domain model (such as Account, Product, Person, Post) and holds business logic. Rails model classes derive from ActiveRecord::Base.
  • View: templates that produce representations of your resources, most often HTML with embedded Ruby (ERB files).
  • Controller: handles incoming HTTP requests and returns a response. Controller classes derive from ActionController::Base.

Which built-in components come with Rails?

Besides the MVC layers, Rails ships with libraries for email, background jobs, WebSockets, file storage and rich text. Active Record, Active Model, Action Pack and Action View can also be used independently outside Rails.

  • Action Mailer: generate and send emails
  • Action Mailbox: receive emails within a Rails application
  • Active Job: declare jobs and run them on a variety of queuing backends
  • Action Cable: integrate WebSockets
  • Active Storage: attach cloud and local files
  • Action Text: handle rich text content
  • Active Support: utility classes and standard library extensions

Install Rails with gem install rails

Install Rails from the command prompt using RubyGems. The README lists Ruby as the prerequisite but does not specify a Ruby version, so check the official guides for requirements before you start.

$ gem install rails

Create a new Rails application

Run rails new followed by your application name. The README uses "myapp" as the example name, and the command creates a folder with that name.

$ rails new myapp

Start the web server and open your app

Move into the application directory and start the server with bin/rails server. Then open http://localhost:3000 in your browser to see the Rails bootscreen, which shows your Rails and Ruby versions. Run bin/rails server with --help or -h to see its options.

$ cd myapp $ bin/rails server

Where to learn next

The official Getting Started guide, the Ruby on Rails Guides and the API documentation are the resources the README points to for building your application.

  • Getting Started with Rails: guides.rubyonrails.org/getting_started.html
  • Ruby on Rails Guides: guides.rubyonrails.org
  • API Documentation: api.rubyonrails.org

What people use it for

  • Building a database-backed website with models, views and controllers
  • Sending transactional emails with Action Mailer
  • Running background jobs with Active Job
  • Adding real-time features over WebSockets with Action Cable
  • Attaching uploaded files with Active Storage
  • Learning MVC web development with Ruby

Frequently asked questions

Is Ruby on Rails free to use?

Yes. Ruby on Rails is released under the MIT License, an open-source licence. You can use, modify and distribute it under those terms.

How do I install Ruby on Rails?

Run gem install rails at the command prompt. The README lists Ruby as a prerequisite but does not state a specific Ruby version, so check the official guides for version requirements.

How do I create and run a new Rails app?

Run rails new myapp to create the application, then cd myapp and bin/rails server to start it. Open http://localhost:3000 to see the bootscreen.

What is MVC in Rails?

MVC stands for Model, View and Controller. Models hold data and business logic, views render output such as HTML, and controllers handle requests and return responses.

What can I use instead of Rails?

The project's comparable frameworks are Django, Laravel, Phoenix and Sinatra. Rails is Ruby-only, so pick another framework if your project must use a different language.

Is Rails good for a very small static site?

Probably not the simplest choice. A lighter tool is likely enough for very small static sites, though this is a general judgment, since the README does not compare project sizes.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Rails suits developers and teams building database-backed web applications in Ruby who want a conventional MVC structure and many built-in components. It is less suited to projects that must use another language, very small static sites, or anyone who needs a non-MVC architecture.

Install options & downloads