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/, scroll to the 'Downloads' section, and download the RailsInstaller for Windows/Ruby 2.1.

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 your git and ssh environment'. 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: wayneeseguin@gmail.com

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.

Click next twice, and select, Use Git from the Windows Command Prompt.

Screenshot showing location choice to use git from Windows Command Prompt

Keep going 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 has some problems. 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.2.2 or earlier, keep following the instructions.

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

Step 5.2: Download the update

Right click -> Save target as... the file rubygems-update-2.2.3.gem to your C:\Sites directory

Step 5.3: Install the update

Back at the command prompt, run the following commands:

gem install --local rubygems-update-2.2.3.gem
update_rubygems --no-ri --no-rdoc

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

gem -v
Expected result:
2.2.3

Step 6: Install Node.js

Go to http://nodejs.org and download the installer

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:
v0.8.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-ri --no-rdoc

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

Step 8: Sanity Check

Type this in the terminal:
ruby -v
Approximate expected result:
ruby 2.1.5p125
The greyed-out text may differ and is not important.
Type this in the terminal:
rails -v
Approximate expected result:
Rails 4.2.x
The greyed-out text may differ and is not important.
Type this in the terminal:
git --version
Approximate expected result:
git version 2.5.0.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. Hint -- click to open the link below, and when you finish those steps, hit the back button in your browser to resume this procedure.

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 Sublime Text 2.

Sublime Text 2 is a good option, if you don't have one yet.

Download Sublime Text 2 here: http://www.sublimetext.com/2

Next Step: