Skip to content

How to install Ruby 3 on rails in Windows 7

June 30, 2011


This is a step by step tutorial that will let you succesfully install Ruby on rails 3 in your Windows 7. The main objective was to ease the installation process which is kind of harsh and bumpy.


  1. Download Ruby Windows installer from this URL.
    Select version 1.8.7, which is the most recommended and stable release for Windows.When installing this software, make sure to check “Add Ruby to PATH”.
  2. After installing Ruby, open CMD and check if you Ruby is accessible by executing the following command:
    ruby -v
    If it works fine you should see the version number of Ruby
  3. Then check if you can access gem command by executing:
    gem -v
  4. As you will see, probably the gem version installed by default is not the latest,
    so you should proceed to update gem like this:
    gem update --system
  5. Now it is time to install Ruby on rails. Rdoc and Ri documents the gems.
    NOTICE: It is well known that there is a bug when generating documentation for some of the gems needed for rails. Since Rails will work without it, let us avoid it until a new solution is published. 
    So you should execute:
    gem install rails --no-ri --no-rdoc
  6. Ruby on rails works with SQLite by default but we will use MySQL.
    In order to let you use both, let us download SQLite and then configure MySQL.
    Download SQLite dlls from here this URL,
    unzip them and copy them to:
  7. Now you should install SQLite gem:
    gem install sqlite3-ruby
  8. Now it is time for MySQL. Go to the MySQL website and download the community edition and after installing it in your OS, download this libMySQL.dll and copy it into the same location you put the SQLite dlls
  9. Now install the MySQL gem.
    NOTICE: Since it is also well known that there is a bug related to mysql2 on windows, please avoid it until they find a proper solution. There are additional procedures to make it work but as I assume that all you would like is to have a functional RoR in your Windows for development (not deployment), save the pain.
    To install the msyql gem execute:
    gem install msyql
  10. Now we are ready to create a testing project in rails.
    Since we are going to use MySQL as DB, we should then execute:
    rails new testproject -d mysql
  11. After creating the project, we must perform the following changes to make it work
    with mysql instead of mysql2 (which gets set by default).
    So please edit the database.yml file and replace every instance of “mysql2” by “mysql”. Then save the file.
    Remember that database.yml is located at the config dir of the new project tree.
  12. Now it is time to modify the Gemfile which is located at the root of the project tree.
    Once edited, you should also replace “mysql2” by “mysql”.
  13. Since there is another issue with rake 0.9, you should also replace the rake reference at the same file (Gemfile), by this more stable version:
    gem 'rake', '0.8.7'
  14. Now you should uninstall rake 0.9 and install rake 0.8.7, so you should execute:
    gem uninstall rake
    gem install rake –v 0.8.7
  15. After this, from the root of your new project, you are ready to execute:
    bundle install
  16. Relax, we’re almost there. You should now try to create CRUD operations for a simple user table. So let us execute:
    rails generate scaffold user name:string email:string
  17. Then, we perform actual changes into the DB by executing:
    rake db:create
    rake db:migrate
  18. Finally, let us run the Rails httpd server:
    rails server
  19. Open your browser and go to: http://localhost:3000/users, you should see the users list ready to add, edit and remove records.

Final comments

If you have followed this tutorial step by step you should be fine, if not let me know. As I said it took me a while to make it all work so I am sharing this in order to save your time, enjoy 😉


From → Ruby on rails

  1. ssdsds permalink

    Thanks a ton. Your step by step instructions for latest version of rails worked like a charm. It ended all problems I’ve been facing for last couple of days.

  2. Thank you so much for this tutorial!!! I spent literally a week to make mysql working with ruby. I am really thankful!

  3. Thanks a lot! It was really helpful!

    I did encounter some problems, so I will post what I had to do to get them solved so other ppl can get it working as well.

    “gem install mysql” did not work for me. Had to use “gem install mysql –platform=ruby — –with-mysql-dir=C:\mysql” (replace C:\mysql for wherever you installed mysql, and watch out for capitals, even in disk drive letters!)

    I didn’t have “gem ‘rake’, ‘0.8.7’” inside my Gemfile,inserting it in the Gemfile before the “gem mysql …” helped (thought this isn’t mandatory and I can remove it now, but it helped the first time).

    I had inside my Gemfile: “gem ‘mysql’, ‘~> 0.2.6′”, this caused an error, replace it for:
    gem ‘mysql’, ‘~> 2.8.0’ (I have mysql 2.8.1, so I thought 2.8.0 should be OK :P)

    the linked libmysql.dll caused me some issues as well, Instead, after installing rails, i grabbed my own libmysql from C:\mysql\lib and copied it to the ruby path (may have to do something with capitals aswell, I know windows is not case sensitive, but apparently rails, ruby and/or mysql is.

    That was it. I’m not saying all these steps are necessary, just that combined they helped me have a working platform 🙂

    Have a nice day!

  4. @chech Thanks a lot for your comments and for taking the time to add solutions to possible problems that may arise on some configurations. 😉

  5. ganapati permalink

    Hi, i am new to the ROR(Ruby on Rails). This step by step procedure is useful a lot. but i need to know some information about IDE’s. how can i develop a project using vs2008 in ROR. how can i integrate my existing project with vs2008. Please help me.

  6. Abid Hussain permalink

    Thanks a lot dear its very nice and to the point step by step instructions

  7. Abdul Gafoor permalink

    Successfully installed/run ROR…thanks for your information, it is really useful

  8. Command 4) gem update –sytem
    Shouldn’t it be “gem update –system” ?

  9. This worked perfectly!!! WOW!

  10. Thanks a ton … i really appreciate 🙂

  11. I did experienced one error when creating the test project.

    Installing json (1.7.3)
    Gem::InstallError: The ‘json’ native gem requires installed build tools.

    Please update your PATH to include build tools or download the DevKit from ‘’ and follow the instructions at ‘’ An error occured while installing json (1.7.3), and Bundler cannot continue. Make sure that `gem install json -v ‘1.7.3’` succeeds before bundling.

    I resolved the problem using these instruction I found here:

    Step 3) … we need to install DevKit from Double click on the exe file and it will extract some files. Now we need command prompt to install this. … go to the path where DevKit files has been extracted. Now Type

    > ruby dk.rb init
    This will create a config.YML file. Open this file using a notepad and review if it found correct path of rub installation. If it’s wrong you can just correct path and save the file. After that type

    > ruby dk.rb install
    This will install DevKit and we are ready to install rails. For details instruction go to there

    Now everything is great!

  12. patel permalink

    Very useful blog thanks buddy…

  13. pixelworks permalink

    ” rails is not recognized as an internal or external command ” error come when enter rails new testproject -d mysql command

    plz help me

    • looks like rails is not in your path (PATH command in an MS-DOS console for Windows), check any rails installation guide to find out how to get it in.

      • moudi permalink

        how to do that ?

      • chech permalink

        My Windows is in another language so translation may differ. This is for windows 7:

        Start -> Control Panel -> System -> Advanced System Configuration -> Advanced Tab -> Environment Variables ->

        Select Path, press Edit, go to the end of the line, make sure that the last entry ends in a semicolon ; if it doesn’t put one, then add:


        and make sure that you change those to where you installed ruby and rails.

        If you don’t know what you are doing follow a tutorial on youtube (search for “windows change path”) as if you delete your path you could harm other applicaitions like Java. Windows will be safe however.

  14. silu permalink

    Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read
    server certificate B: certificate verify failed (
    An error occurred while installing coffee-script-source (1.4.0), and Bundler can
    not continue.
    Make sure that `gem install coffee-script-source -v ‘1.4.0’` succeeds before bun

  15. sarathi permalink

    Hey when I use this link http://localhost:3000/users. Its shows Could not connect error . In mysql server my port number is 3306. So I try http://localhost:3306/users in my browser Some unknown file starts download. What is this file ?

  16. Sasmit permalink

    I am new to Ruby On Rails. I am trying to install it on windows 7. I do not need MySql setup or database with Ruby On Rails. I have tried to install Ruby On Rails using the below steps but it is giving me error. Can you please help me with step by step guide?

      • Sasmit permalink

        Thank you for quick response.

        I am trying to install version 1.8.7 on windows 7. I was successful till step 4.
        While executing step 5 it gave me this error

        Fetching: json-1.8.0.gem (100%)
        ERROR: Error installing rails:
        The ‘json’ native gem requires installed build tools.

        Please update your PATH to include build tools or download the DevKit
        from ‘’ and follow the instructions
        at ‘’

        Then checking the blog I found Chris Simeone (@SimspaceDev) solutions. I installed DevKit on my system. Then again executed gem install rails –no-ri –no-rdoc

        but now I am getting below error.

        C:\>gem install rails –no-ri –no-rdoc
        Temporarily enhancing PATH to include DevKit…
        Building native extensions. This could take a while…
        ERROR: Error installing rails:
        ERROR: Failed to build gem native extension.

        C:/Ruby187/bin/ruby.exe extconf.rb
        creating Makefile

        Makefile:121: *** target pattern contains no `%’. Stop.

        Gem files will remain installed in C:/Ruby187/lib/ruby/gems/1.8/gems/json-1.8.0
        for inspection.
        Results logged to C:/Ruby187/lib/ruby/gems/1.8/gems/json-1.8.0/ext/json/ext/gene

        What can be done? Where am I going wrong?

  17. martha permalink

    i am trying to install and after inserting this command rails new testproject -d mysql its bringing me not recognised as an internal or external command even after using all the solutions given above

  18. Manish permalink

    I am also step 5..
    getting error as
    Error installing rails:
    The ‘atomic’ native gem requires installed build tools.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: