Getting Started with Ruby on Rails: Installation

May 17 2009 by Phil McClure | 29 Comments

Getting Started with Ruby on Rails: Installation

Introduction

This article will guide you through the process of installing Ruby on Rails, and any other software that is required to begin using it.

This is the first of two articles, Part 1 will show you how to install Ruby on Rails (on Windows) and Part 2 will show you how to create a basic blog.

In order to create a web application with Rails, you will need the following software:

  • Ruby (The interpreter for the Ruby Language)
  • DBMS (This will be MySQL for this tutorial)
  • Rails (Obviously)

First, Installing Ruby!

Ruby is an interpreted language, which means that you don’t have to compile your code before you can execute it – it is interpreted at runtime. For this, we require the Ruby interpreter.

So let’s get started! To install the Ruby interpreter, you will need to download one-click installer.

After initiating the setup process, by double clicking on the one-click installer, you will be guided through the installation by the setup wizard, as follows:

This screen tells you what you are installing (Ruby!) and what version. Nothing much to see here, Click "Next" to move on.

Ruby Installation Wizard.

Simply agree to the license agreement by clicking "I Agree" (or read it, if you have too much time on your hands).

Installation Wizard - Agree to terms and conditions.

This screen will ask you what additional components you want to install. "ScITE" and "Enable RubyGems" should be ticked, as shown, then click "Next".

Installing Ruby - Checking options.

Choose a location for your installation. It is suggested that you leave this as the default.

Ruby Installation - choose installation location.

And finally, click "Install" to complete the installation.

Ruby on Rails Installation - Clicking install to complete installation.

After the installation is complete, you can check that the installation is correct by keying ruby -v at a command prompt. The version number the Ruby interpreter should appear, as shown below. Also, check to see if the gem command is available by keying gem -v.

Installing Ruby - checking version.

Installing MySQL

First, download the setup file by going to the MySQL downloads page. About half way down the page you should see a link "No thanks, just take me to the downloads!"; click on this link, then pick the download mirror you wish to obtain the files from.

Once downloaded, to install MySQL, you can follow any of the helpful tutorials out there. This one, at Global Nerdy, will do just fine.

Important: Remember to take a note of your root password when you create it!

Installing Rails

Installing Rails is simple using the RubyGems package manager (which should be installed along with the Ruby interpreter). Simply key the following at a command prompt:

> gem install rails

Installing Rails - checking version number.

Once this command has finished executing, you can check that it has installed correctly by keying rails -v at a command prompt:

Note: don’t worry too much about the version number. As long as it’s 2.2.2 or above, you’re fine.

That’s it! You are now ready to write Ruby on Rails web applications.

In Part 2 of this tutorial, you will learn how to create a basic blog from scratch.

Other Useful Resources for Getting Started

Here are a handful of excellent resources on Ruby on Rails that we recommend.

Other Ruby on Rails Installation Tutorials

The Ruby Language

Editors

Blogs

Screencasts

The "Getting Started with Ruby on Rails" Series

This is a two-part article series that is aimed at getting beginner’s up and running with Rails. Stay tuned by subscribing to the RSS feed so that you can be notified when part two is published.

Related content

About the Author

Phil McClure is a Software Developer from Belfast, Northern Ireland. His main interests are software architecture, design patterns and how these can be applied to web development. Phil blogs at theRailWorld.com. Follow him on Twitter.

29 Comments

Tukang Nggame

May 17th, 2009

Ruby on Rails something new for me
from this post i’ll learn about it
thanks for share, this post very helpful

Bogdan Pop

May 17th, 2009

I don’t get it. The whole article is RubyOnRails@Windows, but then, in the end there’s links to Linux / Mac OS X editors. Are they any good for Windows users?

I see there’s no link to http://www.ruby-forum.com, which is probably the best resource to finding answers to your questions. Lots of great people over there, and they reply blazing fast as opposed to pretty much any other place on the net.

I see part 2 is about creating a simple blog. I sure hope so it won’t be a text version of the one located at http://rubyonrails.org/screencasts .

Adrian

May 17th, 2009

Can I use the mySQL from another six revisions tutorial that showed you how to install xampp and wordpress?

Jacob Gube

May 17th, 2009

@Adrian: You definitely can, and in fact, it’s a good idea to. Here’s a great step-by-step guide specifically on getting RoR to work with XAMPP, called “Installing Ruby on Rails (ROR) with XAMPP“.

Luis Lavena

May 18th, 2009

Nice write up.

I have a recommendation: do not check Enable RubyGems.

The name of the option is misleading. What that actually does is set RUBYOPT=rubygems which forces RubyGems load on every ruby script or tool that is called.

Also, it used to interfere when updating RubyGems (gem update –system) and also when developing your own gems or updates and having those already installed.

That’s why was turned off in latest Release candidate and indicated in the changelog of the release.

Cheers!

Derek Neighbors

May 18th, 2009

This is an excellent source for getting ruby on rails setup and running on windows. Thanks for sharing it.

Ben

May 18th, 2009

This is good! Please go ahead with this series about RoR!

Phil

May 18th, 2009

@Bogdan Pop – There is a section called “Other Ruby on Rails Installation Tutorials”, this covers Linux/OS X tutorials. I will try to make the blog tutorial as unique as possible, using as many new features that I can find. ps.. sorry for leaving out the ruby forum, just not a resource I use.

danwer

May 18th, 2009

This is good! Please go ahead with this series about RoR!!!

James

May 18th, 2009

Nice tut, but bummer that it’s only for Windows.

AkitaOnRails

May 18th, 2009

You will want to use the official Rails Guides. Many people think that there is no documentation for Rails, which is not true. So go to http://guides.rails.info to get started.

If you’re interested my blog also covers a lot of stuff, including tutorials, which you can find at http://www.akitaonrails.com/tutorials, including several Windows related articles.

Robert Melton

May 18th, 2009

Vim is ALL platforms. :)

Nouman Saleem

May 18th, 2009

Best ruby online tutorials: http://poignantguide.net/ruby/

Paul Datta

May 19th, 2009

Windows users who are just getting on rails should try either using InstantRails-http://snurl.com/iba3y (Rails version 2.0) or Netbeans (this comes with updated rails – 2.1 or later I guess) – http://snurl.com/iba85
InstantRails comes with mongrel and mysql (bundled) minus the ide, netbeans gives you everything else minus the database :-)
I choose Netbeans as windows users lack a textmate :-)

mupet

May 19th, 2009

I have no experience with ruby, what is the best feature of ruby?, still using my favorit language PHP

satish.borkar

May 22nd, 2009

may i know in which language ruby on rails is developed?

Janko

May 22nd, 2009

Looking forward to seeing part 2!

vivian

May 30th, 2009

thanks for the actually decent installation article. so hard to find one.

bryan

June 2nd, 2009

When I download MySQL, the following error occurs when I attempt to login. I have looked through the forums and to no avail I am still having this problem. can anyone help?

Can’t connect to MySQL server on ‘localhost’ (10061)

Adrian

June 14th, 2009

I can’t migrate the comments table, but posts worked the first time. (i took a screenshot):

http://www.flickr.com/photos/33883927@N04/3624907729/

I have tried a lot of things. Can anyone fix this?

Adrian

June 14th, 2009

oh oops that last comment was for a different post. SORRY!! please delete it! i am going to post that at the right place now…

Paul Mccann

July 19th, 2009

When i try to install in C:\xampp\ruby it asks me if I want to uninstall the previous version (which there is not one), when I click yes it loads the xampp uninstaller!!

Bit weird, so I am unable to install ruby into the xampp directory for some reason!

Max

October 19th, 2009

This breaks the installation down into 3 parts. Installing Ruby, MySQL, and Rails. Installing RoR in this order is crucial having a good web server. Another article that gets you started on the right path of setting up Ruby on Rails is located here http://topcweb.com/content/ruby-rails-setup.

Martin

March 18th, 2010

This has been the best installation article description i have seen on the web for installing ror.

Thank you so much.

sharath

April 29th, 2010

Good installation. But when I downloaded ver 1.8.7 teh UI asking for editor does not appear during installation

Krishan

June 11th, 2010

You can use http://www.tutorialforbeginner.com/ror for learning rails. It is very good site.

Kalavati Singh

November 22nd, 2010

Can any one tell me how to resolve the following error

ERROR: http://rubygems.org/ does not appear to be a repository
ERROR: could not find gem rails locally or in a repository

Kevin

December 9th, 2010

For the most part this is a good start article as far as part one but where is part two? Also why bother putting up a comment form if you are going to ignore the questions? Bottom line is this is only half of a complete article where the only real value is in the links to complete articles from others who have commented. To whom I say thank you very much for doing what this author obviously is not capable of!

Mangesh

April 5th, 2011

Nice Job……………..

Leave a Comment

Subscribe to the comments on this article.