Active Rails

Generated from b81e05214 on 2020-09-01

Rails Installation Guide - Windows

It’s a bit tedious to setup Ruby and Rails on Windows. Windows doesn’t have a package manager built in, and doesn’t have support for some native gems. But Ruby development is still possible, and for the purposes of this book, it’s perfectly fine to use.

This guide has been verified with Windows 10, Ruby 2.6.6 and Rails 6.0.2.

We’ll be taking the approach of installing Ruby via RubyInstaller, and then installing DevKit that enables you to build many of the C/C++ extensions available.


To start with, we’re going to install Ruby using RubyInstaller. Visit the RubyInstaller website, and grab the latest version for your operating system - we’re using the 'Ruby 2.6.6' version. It’s the one in bold here:


Follow the instructions in the RubyInstaller, making sure to tick the checkbox that says "Add Ruby executables to your path" on the final step before completing the installation process.

The installer will then open a command prompt that prompts you to install the MSYS2 development tools:

ruby installer

For this, select the first option.

After installation, open the command prompt (which you can do by right-clicking on the Windows icon in the bottom left corner, and clicking "Command Prompt") and run ruby -v. You should see something like this:

ruby 2.6.6p146 (2020-03-31 revision 67876) [x64-mingw32]

Node.js + Yarn

You’ll also need to have another programming language called Node.js installed. Wait, why do you need another programming language to write Ruby apps? Well, way back when, many moons ago in Rails 3.1, the Rails core team introduced a new feature called the asset pipeline. The asset pipeline is a way to make your stylesheets, JavaScript files and other assets, much more efficient. It includes support for preprocessors like Sass, automatic concatenation and minification of files, appending of file digests to filenames to prevent misbehaving browsers from caching things they shouldn’t, and much much more.

On top of this, more recent versions of Rails use a gem called Webpacker, which works in a similar manner.

To get the full power of the asset pipeline or Webpacker, you need to have Node installed. To get Node, go to, and select the "LTS" (Long Term Support) version:

windows node

Run this installer to install Node. During the setup, you’ll be prompted to install additional tools:

windows node additional tools

Make sure you check this box!

Once the installer has finished, you’ll be prompted to install those additional tools. Continue through these prompts until they’re finished.

Open a new command prompt and then run node -v. If you see "v12.16.2", then Node has been installed.


The next thing we need to install for Node is a package manager called Yarn. This is used by Rails to install files for Webpacker. We can install Yarn with this command:

npm install -g yarn

Verify this has been installed by running yarn -v. As of this time of writing, Yarn’s version is 1.22.4. If you see any version number, then that is fine.


New Rails applications start out as Git repositories, and so we will need to install Git.

If you do not do this step, when you generate a new Rails application it will only generate some of the files. You’ll be missing a bunch, and your Rails app will not work.

You can do this by going to and downloading the "64-bit Git for Windows Setup" version. Run through this installer.

To verify Git has been installed, start the Command Prompt and run:

git --version

You should see something that looks like:

git version


So now you have a working Ruby. What about Rails?

Ruby comes with its own package manager called RubyGems, and this is what we can use to install Rails. Gems are just little bundled-up packages of Ruby code, and Rails is just a gem. We can install Rails with this command:

$ gem install rails -v "~> 6.0.0" --no-document

This will install the latest version of the 6.0.x branch of Rails. At the current and all of its dependencies. It’ll take a while, as it figures out the dependencies, installs the gems, and then parses and installs documentation. (You can skip the documentation install by running the command with --no-document, eg. gem install rails --no-document. But hey, you might want it one day!)

When it’s done, verify the installation by running rails -v - it should tell you that it’s using a version starting with "6.0". Hooray!


However, there are a couple more things you will need to do, before starting an app. These are minor gotchas, that simply exist because Rails gives you a lot of choice in what libraries you use with your app.

One of those choices is of a database library. By default, when generating an app, Rails will try to configure the app to use SQLite, a simple file-based database system. This is a decent choice for learning, and will work out of the box on Windows.

However, once you get going with the application you may wish to switch to using a different database system, such as MySQL or PostgreSQL. These won’t work out of the box on Windows - you’ll need to fetch and install the database systems yourself.

If you wanted to use MySQL, you’ll need to visit the MySQL website at, and go to the Downloads page. There, under MySQL Community Edition, you can click through and download the MySQL Community Server. If you wanted to use PostgreSQL, you’ll need to visit, and download the Windows binary package from the Downloads page.

Starting a Rails application

Once all that complicated setup is done, starting a new Rails app is trivial. Simply enter in your terminal:

$ rails new my_awesome_app

Which will create a new app using SQLite, in the my_awesome_app directory of your current folder. This will also install Once that’s complete, you can start the Rails server:

$ cd my_awesome_app
$ rails server

Once Puma tells you it has loaded on port 3000, you can open up a browser and visit http://localhost:3000.

You should see "Yay! You’re on Rails!"


© Ryan Bigg, Rebecca Le, Kieran Andrews & Robin Klaus