There’s some really exciting stuff in Rails 7 – not least the promise of a simpler story about managing JavaScript dependencies.
Here are the steps to install it
1. Check you’re using Ruby 2.7 or later (3.0.0 preferred):
ian@ecce ~/dev/rails7 $ ruby -v
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin18]
2. Create a new directory to work in and create an empty Gemfile in it
ian@ecce ~/dev $ mkdir rails7
ian@ecce ~/dev $ cd rails7
ian@ecce ~/dev/rails7 $ touch Gemfile
ian@ecce ~/dev/rails7 $ subl Gemfile
3. Paste the following into the empty Gemfile and save changes
source 'https://rubygems.org'
gem 'rails', git: 'https://github.com/rails/rails.git', branch: 'main'
4. Run Bundler to install the current edge gems for your current Ruby
ian@ecce ~/dev/rails7 $ bundle
Fetching https://github.com/rails/rails.git
...
Using railties 7.0.0.alpha2 from https://github.com/rails/rails.git (at main@2a32c4b)
Using rails 7.0.0.alpha2 from https://github.com/rails/rails.git (at main@2a32c4b)
Bundle complete! 1 Gemfile dependency, 40 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
ian@ecce ~/dev/rails7 $
5. Use rails new and pass it the current directory, specify the --dev flag to ensure it uses a pre-release version of Rails, and --force to overwrite the current Gemfile
ian@ecce ~/dev/rails7 $ bundle exec rails new . --dev --force
exist
create README.md
create Rakefile
create .ruby-version
create config.ru
create .gitignore
create .gitattributes
force Gemfile
run git init from "."
Initialized empty Git repository in /Users/ian/Documents/dev/rails7/.git/
create app
create app/assets/config/manifest.js
create app/assets/stylesheets/application.css
create app/channels/application_cable/channel.rb
create app/channels/application_cable/connection.rb
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/jobs/application_job.rb
create app/mailers/application_mailer.rb
create app/models/application_record.rb
create app/views/layouts/application.html.erb
create app/views/layouts/mailer.html.erb
create app/views/layouts/mailer.text.erb
create app/assets/images
create app/assets/images/.keep
create app/controllers/concerns/.keep
create app/models/concerns/.keep
create bin
create bin/rails
create bin/rake
create bin/setup
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/cable.yml
create config/puma.rb
create config/storage.yml
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/assets.rb
create config/initializers/content_security_policy.rb
create config/initializers/cors.rb
create config/initializers/filter_parameter_logging.rb
create config/initializers/inflections.rb
create config/initializers/new_framework_defaults_7_0.rb
create config/initializers/permissions_policy.rb
create config/locales
create config/locales/en.yml
create config/master.key
append .gitignore
create config/boot.rb
create config/database.yml
create db
create db/seeds.rb
create lib
create lib/tasks
create lib/tasks/.keep
create lib/assets
create lib/assets/.keep
create log
create log/.keep
create public
create public/404.html
create public/422.html
create public/500.html
create public/apple-touch-icon-precomposed.png
create public/apple-touch-icon.png
create public/favicon.ico
create public/robots.txt
create tmp
create tmp/.keep
create tmp/pids
create tmp/pids/.keep
create tmp/cache
create tmp/cache/assets
create vendor
create vendor/.keep
create test/fixtures/files
create test/fixtures/files/.keep
create test/controllers
create test/controllers/.keep
create test/mailers
create test/mailers/.keep
create test/models
create test/models/.keep
create test/helpers
create test/helpers/.keep
create test/integration
create test/integration/.keep
create test/channels/application_cable/connection_test.rb
create test/test_helper.rb
create test/system
create test/system/.keep
create test/application_system_test_case.rb
create storage
create storage/.keep
create tmp/storage
create tmp/storage/.keep
remove config/initializers/cors.rb
remove config/initializers/new_framework_defaults_7_0.rb
run bundle install
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Fetching gem metadata from https://rubygems.org/............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies....
Using rake 13.0.6
Using concurrent-ruby 1.1.9
Using i18n 1.8.11
Using minitest 5.14.4
Using tzinfo 2.0.4
Using activesupport 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Using builder 3.2.4
Using erubi 1.10.0
Using mini_portile2 2.6.1
Using racc 1.6.0
Using nokogiri 1.12.5 (x86_64-darwin)
Using rails-dom-testing 2.0.3
Using crass 1.0.6
Using loofah 2.12.0
Using rails-html-sanitizer 1.4.2
Using actionview 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Using rack 2.2.3
Using rack-test 1.1.0
Using actionpack 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Using nio4r 2.5.8
Using websocket-extensions 0.1.5
Using websocket-driver 0.7.5
Using actioncable 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Using globalid 1.0.0
Using activejob 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Using activemodel 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Using activerecord 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Using marcel 1.0.2
Using mini_mime 1.1.2
Using activestorage 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Using mail 2.7.1
Using actionmailbox 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Using actionmailer 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Using actiontext 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Using public_suffix 4.0.6
Fetching addressable 2.8.0
Installing addressable 2.8.0
Using bindex 0.8.1
Using bundler 2.1.4
Fetching matrix 0.4.2
Installing matrix 0.4.2
Using regexp_parser 2.1.1
Using xpath 3.2.0
Fetching capybara 3.36.0
Installing capybara 3.36.0
Fetching childprocess 4.1.0
Installing childprocess 4.1.0
Fetching io-console 0.5.9
Installing io-console 0.5.9 with native extensions
Fetching reline 0.2.7
Installing reline 0.2.7
Fetching irb 1.3.7
Installing irb 1.3.7
Fetching debug 1.3.4
Installing debug 1.3.4 with native extensions
Using method_source 1.0.0
Using thor 1.1.0
Using zeitwerk 2.5.1
Using railties 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Using rails 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Fetching importmap-rails 0.9.1
Installing importmap-rails 0.9.1
Fetching jbuilder 2.11.3
Installing jbuilder 2.11.3
Fetching puma 5.5.2
Installing puma 5.5.2 with native extensions
Fetching rexml 3.2.5
Installing rexml 3.2.5
Fetching rubyzip 2.3.2
Installing rubyzip 2.3.2
Fetching selenium-webdriver 4.1.0
Installing selenium-webdriver 4.1.0
Using sprockets 4.0.2
Fetching sprockets-rails 3.4.1
Installing sprockets-rails 3.4.1
Using sqlite3 1.4.2
Fetching stimulus-rails 0.7.3
Installing stimulus-rails 0.7.3
Fetching turbo-rails 0.9.0
Installing turbo-rails 0.9.0
Fetching web-console 4.2.0
Installing web-console 4.2.0
Fetching webdrivers 5.0.0
Installing webdrivers 5.0.0
Bundle complete! 14 Gemfile dependencies, 65 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
run bundle binstubs bundler
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
rails importmap:install
Add Importmap include tags in application layout
insert app/views/layouts/application.html.erb
Create application.js module as entrypoint
create app/javascript/application.js
Use vendor/javascript for downloaded pins
create vendor/javascript
create vendor/javascript/.keep
Ensure JavaScript files are in the Sprocket manifest
append app/assets/config/manifest.js
Configure importmap paths in config/importmap.rb
create config/importmap.rb
Copying binstub
create bin/importmap
rails turbo:install stimulus:install
Import Turbo
append app/javascript/application.js
Pin Turbo
append config/importmap.rb
Enable redis in bundle
gsub Gemfile
run bundle install
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Fetching gem metadata from https://rubygems.org/............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 13.0.6
Using concurrent-ruby 1.1.9
Using i18n 1.8.11
Using minitest 5.14.4
Using tzinfo 2.0.4
Using activesupport 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Using builder 3.2.4
Using erubi 1.10.0
Using mini_portile2 2.6.1
Using racc 1.6.0
Using nokogiri 1.12.5 (x86_64-darwin)
Using rails-dom-testing 2.0.3
Using crass 1.0.6
Using loofah 2.12.0
Using rails-html-sanitizer 1.4.2
Using actionview 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Using rack 2.2.3
Using rack-test 1.1.0
Using actionpack 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Using nio4r 2.5.8
Using websocket-extensions 0.1.5
Using websocket-driver 0.7.5
Using actioncable 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Using globalid 1.0.0
Using activejob 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Using activemodel 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Using activerecord 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Using marcel 1.0.2
Using mini_mime 1.1.2
Using activestorage 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Using mail 2.7.1
Using actionmailbox 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Using actionmailer 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Using actiontext 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Using public_suffix 4.0.6
Using addressable 2.8.0
Using bindex 0.8.1
Using bundler 2.1.4
Using matrix 0.4.2
Using regexp_parser 2.1.1
Using xpath 3.2.0
Using capybara 3.36.0
Using childprocess 4.1.0
Using io-console 0.5.9
Using reline 0.2.7
Using irb 1.3.7
Using debug 1.3.4
Using method_source 1.0.0
Using thor 1.1.0
Using zeitwerk 2.5.1
Using railties 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Using rails 7.0.0.alpha2 from source at `/Users/ian/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/rails-2a32c4b679a7`
Using importmap-rails 0.9.1
Using jbuilder 2.11.3
Using puma 5.5.2
Fetching redis 4.5.1
Installing redis 4.5.1
Using rexml 3.2.5
Using rubyzip 2.3.2
Using selenium-webdriver 4.1.0
Using sprockets 4.0.2
Using sprockets-rails 3.4.1
Using sqlite3 1.4.2
Using stimulus-rails 0.7.3
Using turbo-rails 0.9.0
Using web-console 4.2.0
Using webdrivers 5.0.0
Bundle complete! 15 Gemfile dependencies, 66 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Switch development cable to use redis
gsub config/cable.yml
Create controllers directory
create app/javascript/controllers
create app/javascript/controllers/index.js
create app/javascript/controllers/application.js
create app/javascript/controllers/hello_controller.js
Import Stimulus controllers
append app/javascript/application.js
Pin Stimulus
append config/importmap.rb
ian@ecce ~/dev/rails7 $
7. Run Rails
ian@ecce ~/dev/rails7 $ rails s
=> Booting Puma
=> Rails 7.0.0.alpha2 application starting in development
=> Run `bin/rails server --help` for more startup options
Puma starting in single mode...
* Puma version: 5.5.2 (ruby 2.7.2-p137) ("Zawgyi")
* Min threads: 5
* Max threads: 5
* Environment: development
* PID: 30814
* Listening on http://127.0.0.1:3000
* Listening on http://[::1]:3000
Use Ctrl-C to stop
