Install and Run Ruby on Rails (Rails) on Windows Platform


In previous article, we learned about how to install ruby on windows operating system. Now we will teach how to install Rails (Ruby on Rails). If you want to work on Ruby on Rails you will need to install the following:

  • Ruby
  • Ruby Gems
  • Development Kit (DevKit)
  • Ruby Rails

Installing Ruby

Click here to see the previous article: "Installing Ruby on Windows Platform" to install ruby on your windows operating system.

Installing Gems

  1. Gems are also installed when you are installing ruby. You can check the version of gem by typing “gem –v” as in the following screenshot:

    Installed gem Version
    Figure 1: Installed gem Version

  2. Type “gem list” to see all installed gems.

    Displaying gem list
    Figure 2: Displaying gem List

  3. Now the next step is to use gem to install rails. But firstly, we have to install "Development Kit (DevKit)" that provides some dependencies for gems.

Installing DevKit

  1. Download the compatible version of Development Kit (DevKit) for your ruby from here.

  2. Now create a new folder "C:\devkit" and extract the DevKit zip (self-extracting exe) file into "C:\devkit" directory.

  3. Now go to Command prompt window and navigate to "C:\devkit" folder and run “ruby dk.rb init” and then “ruby dk.rb install”.

    Development Kit Installation
    Figure 3: Development Kit Installation

Installing Rails

  1. After installing gems and devkit, now install rails by using gems because Rails is a ruby gem.

  2. Navigate back to "C:\RubyRails\Ruby" in command prompt and run the following command:

    "gem install rails"

    Installing Rails
    Figure 4:
    Installing Rails

  3. If any error occurred in this command, you can update gems by "gem update --system" command to install latest version of gems. Then run "bundle install" to bundle updated gems and run "gem install rails" command again.

  4. It will install rails and "ri" documentation for ruby rails. At the command prompt window type "ri" command, it asks to type a method. You can type a look up method "to_a".

    Running ri Command
    Figure 5: Running “ri” Documentation

  5. Now if you want to exit "ri" documentation, press Ctrl + C.

Creating the First Rails Application

  1. Now create an empty directory “C:\RubyRails\Rails” and navigate to the directory at command prompt. After that type the following:

    “rails new railsapp”

    New Rails App
    Figure 6: New Rails App

  2. This will create a new application in the directory folder “railsapp”.

  3. If you can see the preceding output window, then the last step is to run the "rails server" or “rails s” to display your rails app on web server. Navigate to the folder “railsapp” and type the following command at your terminal or command prompt:

    "rails server"

    Running rails server
    Figure 7:
    Running "rails server" or “rails s”.

  4. Open your browser and type the url “localhost:3000” and press enter key. This start the rails built-in web server WEBrick. WEBrick webserver started on port 3000.

    WEBrick Web Server
    Figure 8: WEBrick Web Server

  5. To stop WEBrick web server press Ctrl + C.


In this article, we saw how to run Ruby on Rails on the windows platform.