Rails new command cheatsheet

Updated: 

Learn essential Rails new command options with this cheatsheet from the Full Stack Rails Mastery course. Streamline your project setup process.

This lesson is from Full Stack Rails Mastery.

Buy Now

The rails new command creates a new Rails application with a default directory structure and configuration at the path you specify.

You can specify extra command-line arguments to be used every time rails new runs in the .railsrc configuration file in your home directory, or in $XDG_CONFIG_HOME/rails/railsrc if XDG_CONFIG_HOME is set.

Note that the arguments specified in the .railsrc file don’t affect the default values shown below.

All the options you can use with the rails new command are listed below in a table.
You can generate the same list by running the following command in your terminal:
bin/rails new -h
Command Description
rails _VERSION_ new APP_PATH

Specify which version to use when creating a new rails application.

Example: rails _7.1.3_ new APP_PATH.

Default: latest version of Rails gem installed for the Ruby version in use.

rails new APP_PATH --database=DATABASE

Preconfigure for selected database (options: mysql, trilogy, postgresql, sqlite3, oracle, sqlserver, jdbcmysql, jdbcsqlite3, jdbcpostgresql, jdbc). Default: sqlite3.

rails new APP_PATH --javascript=JAVASCRIPT

Choose JavaScript approach (options: importmap (default), bun, webpack, esbuild, rollup). Default: importmap

rails new APP_PATH --css=CSS

Choose CSS processor (options: tailwind, bootstrap, bulma, postcss, sass). Check https://github.com/rails/cssbundling-rails for more options

rails new APP_PATH --asset-pipeline=ASSET_PIPELINE

Choose your asset pipeline (options: sprockets (default), propshaft). Default: sprockets

rails new APP_PATH --api

Preconfigure smaller stack for API only apps. Default: false

rails new APP_PATH --minimal

Preconfigure a minimal rails app

rails new APP_PATH --template=TEMPLATE

Path to some application template (can be a filesystem path or URL)

rails new APP_PATH --ruby=PATH

Path to the Ruby binary of your choice. Default: /Users/hrishi/.rvm/rubies/ruby-3.2.2/bin/ruby

rails new APP_PATH --name=NAME

Name of the app

rails new APP_PATH --dev, --no-dev, --skip-dev

Set up the application with Gemfile pointing to your Rails checkout

rails new APP_PATH --edge, --no-edge, --skip-edge

Set up the application with a Gemfile pointing to the 7-1-stable branch on the Rails repository

rails new APP_PATH --master, --main, --no-main, --skip-main

Set up the application with Gemfile pointing to Rails repository main branch

rails new APP_PATH --rc=RC

Path to file containing extra configuration options for rails command

rails new APP_PATH --no-rc

Skip loading of extra configuration options from .railsrc file

rails new APP_PATH --skip-active-record

Skip Active Record files

rails new APP_PATH --skip-test

Skip test files

rails new APP_PATH --skip-system-test

Skip system test files

rails new APP_PATH --skip-git

Skip git init, .gitignore and .gitattributes

rails new APP_PATH --skip-bundle

Don't run bundle install

rails new APP_PATH --skip-javascript

Skip JavaScript files

rails new APP_PATH --skip-action-mailer

Skip Action Mailer files

rails new APP_PATH --skip-active-storage

Skip Active Storage files

rails new APP_PATH --skip-hotwire

Skip Hotwire integration

rails new APP_PATH --skip-sprockets

Skip Sprockets files

rails new APP_PATH --skip-keeps

Skip source control .keep files

rails new APP_PATH --skip-spring

Skip Spring gem

rails new APP_PATH --skip-bootsnap

Skip Bootsnap gem

rails new APP_PATH --skip-namespace

Skip namespace (affects only isolated engines). Default: false

rails new APP_PATH --skip-collision-check

Skip collision check. Default: false

rails new APP_PATH --skip-docker

Skip Dockerfile, .dockerignore and bin/docker-entrypoint

rails new APP_PATH --skip-action-mailbox

Skip Action Mailbox gem

rails new APP_PATH --skip-action-text

Skip Action Text gem

rails new APP_PATH --skip-active-job

Skip Active Job

rails new APP_PATH --skip-action-cable

Skip Action Cable files

rails new APP_PATH --skip-asset-pipeline

Indicates when to generate skip asset pipeline

rails new APP_PATH --skip-jbuilder

Skip jbuilder gem

rails new APP_PATH --skip-dev-gems

Skip development gems (e.g., web-console)

rails new APP_PATH --skip-decrypted-diffs

Don't configure git to show decrypted diffs of encrypted credentials