Other Pages

Expand All

Windows

These instructions should work for all versions of Windows from XP to Windows 8.

You may need to login as Administrator, or give the Administrator password when installing some programs, depending on your Windows version and user settings.

Step 1: Run RailsInstaller

RailsInstaller includes Rails, Ruby, Git and SQLite.

Go to http://railsinstaller.org/en, scroll to the 'Downloads' section, and download the RailsInstaller for Windows/Ruby 2.3.8.

Click on the downloaded file to run the install wizard. Click Next at each step to accept the defaults.

Be sure to check the boxes for Install git (recommended) and Add executables for Ruby, DevKit Git (if checked above) to the PATH

Screenshot showing location of checkboxes for ensuring that Git is installed

Rails will be installed in C:\RailsInstaller and the directory for your Rails projects will be C:\Sites

Step 2: Configure your git and ssh environment

At the end of the installer there will be a checkbox asking 'Configure git and ssh when installation has completed'. Leave this box checked. It will open a terminal window that you need to type into.

When it asks Please enter your name, for example mine is: Wayne E. Seguin

Type your actual full name into the console and press [enter]

When it asks Please enter your email address, for example mine is: [email protected]

Type your actual email address into the console and press [enter]

Use the same email address for heroku, git, github, and ssh.

After this step you will have some git config settings and you will also have an ssh key.

Here is a summary of your settings after this process:

Screenshot showing correct git, ruby, rails and ssh settings

Close the command prompt window.

Step 3: Update Git

The version of Git that comes with RailsInstaller is old, so we will be updating that next.

Go to http://git-scm.com and download the installer. You want version 1.9.5 or newer.

Run the installer, and it will ask you where you want to install it. Change it FROM C:\Program Files\Git TO, C:\RailsInstaller\Git like the picture below.

Screenshot showing the step of installation where the location to install git is set

It will warn you that the directory already exists. Click yes to install to that folder anyway.

Keep going using the default selections and you'll have the latest version of Git installed!

Step 4: Open a Terminal

Much of using Rails is typing commands and hitting [enter]. Your experience using Rails on Windows greatly depends on your making friends with the terminal window. Normally you will work in a terminal window and keep it open along with your browser.

The Terminal is also called the Command Prompt, Command Line, DOS Prompt, or DOS Window.

RailsInstaller made a special Terminal for you to use when you're working on Ruby, Rails, or Git.

To open the special Terminal, search for Command Prompt with Ruby and Rails.

Windows 7Screenshot showing search for command prompt
Windows 8Screenshot showing search for command prompt

You should do all your Rails work in this RailsInstaller DOS window.

Pin It to Win It

Pinning the Command Prompt to the taskbar is a handy shortcut.

Pin the Command Prompt to the Task Bar

Step 5: Update RubyGems

The version of RubyGems that comes with RailsInstaller may be outdated. Follow these steps to upgrade it!

Step 5.1: Check to see if you need to update

Type this in the terminal:
gem -v

If the output is 2.6.7 or later, skip to the next step!

Step 5.2: Install the latest version of RubyGems

Otherwise, run the following command:

gem update --system --no-document

Close and reopen your command prompt, then verify you have the upgraded RubyGems by typing this in the terminal:

gem -v
Approximate expected result:
2.6.9
The greyed-out text may differ and is not important.

As long as the version is at least 2.6.7, you should be fine!

Step 6: Install Node.js

Go to http://nodejs.org and download the installer. Pick the one that is "recommended for most users."

Click on the downloaded file to run the install wizard. Click Next at each step to accept the defaults.

Reboot your computer.

Once your computer is back up, load Command Prompt with Ruby and Rails and...

Type this in the terminal:
node -v
Approximate expected result:
v6.x.x
The greyed-out text may differ and is not important.

Step 7: Update Rails

Currently, RailsInstaller installs Rails 4.1.x, but we want the latest. Upgrading Rails is pretty easy:

Type this in the terminal:
gem install rails --no-document

...and you're done. New Rails! Woo.

Step 8: Sanity Check

Type this in the terminal:
ruby -v
Approximate expected result:
ruby 2.3.8.4
The greyed-out text may differ and is not important.
Type this in the terminal:
rails -v
Approximate expected result:
Rails 5.0.x
The greyed-out text may differ and is not important.
Type this in the terminal:
git --version
Approximate expected result:
git version 2.9.2.windows.1
The greyed-out text may differ and is not important.

Step 9: Configure the Windows Terminal

Take a moment to configure the Command Prompt with Ruby and Rails so that it is a good height and width and has a nice font.

Right-click on the menu bar and select Properties

Under the Font tab, select Lucida Console from the font chooser box. This lets you view non-ascii characters.

In the Layout tab, adjust Window Size so the window is about half as wide as your screen, and is as tall as possible without covering the task bar (this may require some trial and error).

Click OK.

Clearing the Terminal

If you ever want to clear the terminal of all its cluttered output

Type this in the terminal:
cls

Command History

The terminal window stores a "command history." To view and re-run previous commands, use the <up arrow> and <down arrow> keys. You can also edit a previous command and run it -- this is handy for long commands, or fixing mistakes, or for cycles (series of commands) that you repeat.

Copy and Paste

It's usually better to type commands in yourself. It takes a little longer but you learn more.

But if you must... in these instructions, where it says: "Type this in the terminal:", you can usually copy the command from this page, and right click in the menu bar or terminal window, then click on "Paste", then hit the [enter] key.

Step 10: Install a Text Editor

You need a text editor to do Ruby. If you already have a preferred text editor, such as vi, emacs, jedit, etc., you can skip this step. It must be a plain text editor and not something with styling like Microsoft Word or WordPad.

Notepad is not a good programming editor, but it will work in a pinch.

When in doubt, use Atom.

Atom is a good option, if you don't have one yet.

Next Step: