Rails 7.0 with Ruby 3.0 on Windows: It just works!

Rails 7.0.0 was released just yesterday and as a Ruby user primarily on Windows, I was keen to see if it works and runs on Windows.

Thanks to the stellar work of everyone involved, it just works. In short, all you need to do is as below:

  1. RubyInstaller – Download and install Ruby 2.7.x or Ruby 3.0.x on your Windows computer
  2. Open a console window, and follow the commands below.
$ gem install rails
$ rails new project0

Once done, go on in to the project0 folder and start the Rails Server

ruby bin\rails server

Then, open a web browser and take a look at http://localhost:3000/ to be greeted with this.

I was expecting to document some workarounds and problems I faced but at least at the very beginning, there was nothing much. I ran into only one thing:

The system cannot find the path specified.
Run turbo:install:redis to switch on Redis and use it in development for turbo streams

I think Redis is a bit more difficult to get running on Windows, but this needs a closer look.

I’m leaving the rest of the command line outputs in the next section so that you can compare and see what kinds of outputs were shown and to see if something on your side worked differently. However, I must say this is a great start!

So, what’s next? Literally, everything! The basic application uses sqlite3 and you might want to use PostgreSQL – you can either install it directly or set it up without an installation. I hope that if I play around a bit more in Rails on Windows, I will try to document what I learn and find.

Detailed steps

Let’s start by seeing the Ruby version we have.

$ ruby -v
ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x64-mingw32]

Next, install Rails.

$ gem install rails
Fetching activesupport-7.0.0.gem
Fetching crass-1.0.6.gem
Fetching loofah-2.13.0.gem
Fetching rails-html-sanitizer-1.4.2.gem
Fetching rails-dom-testing-2.0.3.gem
Fetching rack-test-1.1.0.gem
Fetching erubi-1.10.0.gem
Fetching builder-3.2.4.gem
Fetching actionview-7.0.0.gem
Fetching actionpack-7.0.0.gem
Fetching railties-7.0.0.gem
Fetching mini_mime-1.1.2.gem
Fetching marcel-1.0.2.gem
Fetching activemodel-7.0.0.gem
Fetching activerecord-7.0.0.gem
Fetching globalid-1.0.0.gem
Fetching activejob-7.0.0.gem
Fetching activestorage-7.0.0.gem
Fetching actiontext-7.0.0.gem
Fetching mail-2.7.1.gem
Fetching actionmailer-7.0.0.gem
Fetching actionmailbox-7.0.0.gem
Fetching websocket-extensions-0.1.5.gem
Fetching websocket-driver-0.7.5.gem
Fetching rails-7.0.0.gem
Fetching nio4r-2.5.8.gem
Fetching actioncable-7.0.0.gem
Successfully installed activesupport-7.0.0
Successfully installed crass-1.0.6
Successfully installed loofah-2.13.0
Successfully installed rails-html-sanitizer-1.4.2
Successfully installed rails-dom-testing-2.0.3
Successfully installed rack-test-1.1.0
Successfully installed erubi-1.10.0
Successfully installed builder-3.2.4
Successfully installed actionview-7.0.0
Successfully installed actionpack-7.0.0
Successfully installed railties-7.0.0
Successfully installed mini_mime-1.1.2
Successfully installed marcel-1.0.2
Successfully installed activemodel-7.0.0
Successfully installed activerecord-7.0.0
Successfully installed globalid-1.0.0
Successfully installed activejob-7.0.0
Successfully installed activestorage-7.0.0
Successfully installed actiontext-7.0.0
Successfully installed mail-2.7.1
Successfully installed actionmailer-7.0.0
Successfully installed actionmailbox-7.0.0
Successfully installed websocket-extensions-0.1.5
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
Successfully installed websocket-driver-0.7.5
Building native extensions. This could take a while...
Successfully installed nio4r-2.5.8
Successfully installed actioncable-7.0.0
Successfully installed rails-7.0.0
Parsing documentation for activesupport-7.0.0
Installing ri documentation for activesupport-7.0.0
Parsing documentation for crass-1.0.6
Installing ri documentation for crass-1.0.6
Parsing documentation for loofah-2.13.0
Installing ri documentation for loofah-2.13.0
Parsing documentation for rails-html-sanitizer-1.4.2
Installing ri documentation for rails-html-sanitizer-1.4.2
Parsing documentation for rails-dom-testing-2.0.3
Installing ri documentation for rails-dom-testing-2.0.3
Parsing documentation for rack-test-1.1.0
Installing ri documentation for rack-test-1.1.0
Parsing documentation for erubi-1.10.0
Installing ri documentation for erubi-1.10.0
Parsing documentation for builder-3.2.4
Installing ri documentation for builder-3.2.4
Parsing documentation for actionview-7.0.0
Installing ri documentation for actionview-7.0.0
Parsing documentation for actionpack-7.0.0
Installing ri documentation for actionpack-7.0.0
Parsing documentation for railties-7.0.0
Installing ri documentation for railties-7.0.0
Parsing documentation for mini_mime-1.1.2
Installing ri documentation for mini_mime-1.1.2
Parsing documentation for marcel-1.0.2
Installing ri documentation for marcel-1.0.2
Parsing documentation for activemodel-7.0.0
Installing ri documentation for activemodel-7.0.0
Parsing documentation for activerecord-7.0.0
Installing ri documentation for activerecord-7.0.0
Parsing documentation for globalid-1.0.0
Installing ri documentation for globalid-1.0.0
Parsing documentation for activejob-7.0.0
Installing ri documentation for activejob-7.0.0
Parsing documentation for activestorage-7.0.0
Installing ri documentation for activestorage-7.0.0
Parsing documentation for actiontext-7.0.0
Installing ri documentation for actiontext-7.0.0
Parsing documentation for mail-2.7.1
Installing ri documentation for mail-2.7.1
Parsing documentation for actionmailer-7.0.0
Installing ri documentation for actionmailer-7.0.0
Parsing documentation for actionmailbox-7.0.0
Installing ri documentation for actionmailbox-7.0.0
Parsing documentation for websocket-extensions-0.1.5
Installing ri documentation for websocket-extensions-0.1.5
Parsing documentation for websocket-driver-0.7.5
Installing ri documentation for websocket-driver-0.7.5
Parsing documentation for nio4r-2.5.8
Installing ri documentation for nio4r-2.5.8
Parsing documentation for actioncable-7.0.0
Installing ri documentation for actioncable-7.0.0
Parsing documentation for rails-7.0.0
Installing ri documentation for rails-7.0.0
Done installing documentation for activesupport, crass, loofah, rails-html-sanitizer, rails-dom-testing, 
rack-test, erubi, builder, actionview, actionpack, railties, mini_mime, marcel, activemodel, activerecord, 
globalid, activejob, activestorage, actiontext, mail, actionmailer, actionmailbox, websocket-extensions, 
websocket-driver, nio4r, actioncable, rails after 82 seconds
27 gems installed

Next, create a new project.

$ rails new project0
      create
      create  README.md
      create  Rakefile
      create  .ruby-version
      create  config.ru
      create  .gitignore
      create  .gitattributes
      create  Gemfile
         run  git init from "."
Initialized empty Git repository in D:/projects/blog/_posts-trials/rails/project0/.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
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
Fetching minitest 5.15.0
Installing minitest 5.15.0
Using tzinfo 2.0.4
Using activesupport 7.0.0
Using builder 3.2.4
Using erubi 1.10.0
Fetching racc 1.6.0
Installing racc 1.6.0 with native extensions
Fetching nokogiri 1.12.5 (x64-mingw32)
Installing nokogiri 1.12.5 (x64-mingw32)
Using rails-dom-testing 2.0.3
Using crass 1.0.6
Using loofah 2.13.0
Using rails-html-sanitizer 1.4.2
Using actionview 7.0.0
Using rack 2.2.3
Using rack-test 1.1.0
Using actionpack 7.0.0
Using nio4r 2.5.8
Using websocket-extensions 0.1.5
Using websocket-driver 0.7.5
Using actioncable 7.0.0
Using globalid 1.0.0
Using activejob 7.0.0
Using activemodel 7.0.0
Using activerecord 7.0.0
Using marcel 1.0.2
Using mini_mime 1.1.2
Using activestorage 7.0.0
Using mail 2.7.1
Using actionmailbox 7.0.0
Using actionmailer 7.0.0
Using actiontext 7.0.0
Using public_suffix 4.0.6
Using addressable 2.8.0
Fetching bindex 0.8.1
Installing bindex 0.8.1 with native extensions
Fetching msgpack 1.4.2
Installing msgpack 1.4.2 with native extensions
Fetching bootsnap 1.9.3
Installing bootsnap 1.9.3 with native extensions
Using bundler 2.2.32
Fetching matrix 0.4.2
Installing matrix 0.4.2
Fetching regexp_parser 2.2.0
Installing regexp_parser 2.2.0
Fetching xpath 3.2.0
Installing 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
Fetching importmap-rails 1.0.1
Installing importmap-rails 1.0.1
Fetching jbuilder 2.11.3
Installing jbuilder 2.11.3
Fetching puma 5.5.2
Installing puma 5.5.2 with native extensions
Using rails 7.0.0
Using rexml 3.2.5
Using rubyzip 2.3.2
Fetching selenium-webdriver 4.1.0
Installing selenium-webdriver 4.1.0
Fetching sprockets 4.0.2
Installing sprockets 4.0.2
Fetching sprockets-rails 3.4.2
Installing sprockets-rails 3.4.2
Using sqlite3 1.4.2
Fetching stimulus-rails 1.0.2
Installing stimulus-rails 1.0.2
Fetching turbo-rails 1.0.0
Installing turbo-rails 1.0.0
Fetching tzinfo-data 1.2021.5
Installing tzinfo-data 1.2021.5
Fetching web-console 4.2.0
Installing web-console 4.2.0
Fetching webdrivers 5.0.0
Installing webdrivers 5.0.0
Bundle complete! 15 Gemfile dependencies, 67 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
         run  bundle binstubs bundler
       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
The system cannot find the path specified.
Run turbo:install:redis to switch on Redis and use it in development for turbo streams
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

This is where we see the one warning and comment:

The system cannot find the path specified.
Run turbo:install:redis to switch on Redis and use it in development for turbo streams

Now, move into that folder (project0 in our case) and start the server by doing ruby bin\rails server in that directory. Remember to hit Ctrl-C to shut down the server once you’re done using it.

$ ruby bin\rails server
=> Booting Puma
=> Rails 7.0.0 application starting in development
=> Run `bin/rails server --help` for more startup options
*** SIGUSR2 not implemented, signal based restart unavailable!
*** SIGUSR1 not implemented, signal based restart unavailable!
*** SIGHUP not implemented, signal based logs reopening unavailable!
Puma starting in single mode...
* Puma version: 5.5.2 (ruby 3.0.3-p157) ("Zawgyi")
*  Min threads: 5
*  Max threads: 5
*  Environment: development
*          PID: 28884
* Listening on http://[::1]:3000
* Listening on http://127.0.0.1:3000
Use Ctrl-C to stop
Started GET "/" for 127.0.0.1 at 2021-12-17 18:22:29 +0800
   (4.5ms)  SELECT sqlite_version(*)
Processing by Rails::WelcomeController#index as HTML
  Rendering C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-7.0.0/lib/rails/templates/rails/welcome/index.html.erb
  Rendered C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-7.0.0/lib/rails/templates/rails/welcome/index.html.erb (Duration: 7.7ms | Allocations: 844)
Completed 200 OK in 65ms (Views: 23.2ms | ActiveRecord: 0.0ms | Allocations: 7937)

Update on the Minor Warning

As I noted earlier, there is a small warning and comment that comes up.

The system cannot find the path specified.
Run turbo:install:redis to switch on Redis and use it in development for turbo streams

I tracked this down to a method in a rake task (within turbo-rails) for installing Turbo and has to do with redis. That method basically checks if redis is available on the system and activates it to use redis if it is. This redirects the output to /dev/null which is not a path on Windows and therefore the error. Also, it uses which and that is not available on Windows either. It’s not a big problem and Rails is still set up properly even if you see that message – you just need to be aware of it and that you’ll need Redis if you want to use it. I opened an issue on the turbo-rails tracker if you want to follow it.

Further update on the issue: I raised a Pull Request to fix that minor issue. It’s been merged and I expect that the next release will fix it, even on Windows.

We are ready for more! If you have any comments, please leave them below so that we can improve this page.

comments powered by Disqus