How to install Ruby on Rails on a windows PC

Note: Tutorial targeted at n00bs and is for a purely developer environemnt not suitable for a production environment (can be used as one but not recommended).

Ruby on Rails or just Rails is a framework for building web applications and is quite famous among the developers, first of all for the use of the wonderful language Ruby and next Rails itself is a wonderful piece of software in itself. Ruby is so english like and has a smooth learning curve especially for those new to programming than those who are used to some other language. Ofcourse when you are used to some language every other language seems to be strange.

Install Guide:

First of all you need to Download a few packages

Ruby Windows Installer - http://rubyforge.org/frs/?group_id=167
MySQL - http://dev.mysql.com/downloads/mysql/5.0.html#win32

The next thing you need depends on weather you have internet access on your developer machine or not, incase you have internet access, just use the following commandafter you have installed Ruby
gem install rails –include-dependencies

Incase you have problem installing using this command because you are currently on the plane or in the desert waging war against terror or may be worse behind a restrictive corporate proxy server, you need to download the gem files and install them individually.

First of all download the latest Rails gem from

http://rubyforge.org/frs/?group_id=307

donwload the file with the .gem extension and then run this command

gem install gem-name-x.x.x –local

example - gem install rails-1.2.3 –local

The gem file should be in the path or else change to the directory where you put the file and then run the command else you are going to get gem file not found error

When you enter the above command it gives an error message saying rail-1.2.3 needs some-other-gem-1.x.x , these are called dependencies, you need these installed before you install rails, so you need to download these gem packages too, so search for the gem file missing at the rubyforge site
I have made a list of dependecnies for the latest version of rails - rails-1.2.3

rake (>= 0.7.2)

http://rubyforge.org/projects/rake/
activesupport (= 1.4.2)

http://rubyforge.org/frs/?group_id=570&release_id=10359
activerecord (= 1.15.3)

http://rubyforge.org/frs/?group_id=182&release_id=10363
actionpack (= 1.13.3)

http://rubyforge.org/frs/?group_id=249&release_id=10360
actionmailer (= 1.3.3)

http://rubyforge.org/frs/?group_id=361&release_id=10365
actionwebservice (= 1.2.3)

http://rubyforge.org/frs/?group_id=567&release_id=10366

grab the latest release of gem files at these project pages and install them using the common command

gem install gemname-1.x.x –local

Once you get rails installed, you can be sure that is has succesfully installed along with all the dependencies. You might wonder, dont these things need a web server like Apache? The answer is yes and no, its actually not necessary but sure is an optio. Ruby has a build in web server WEBrick, which lets you get started and running with just one command, no install needed!

Now that you have a developer Rails environemnt setup, you can go whip a new rails application in minutes with this tutorial at IBM Developer Works

7 comments ↓

#1 » links for 2007-05-17 [ joseluizcoe.com ] on 05.24.07 at 7:09 am

[...] How to install Ruby on Rails on a windows PC « Anything, but not Everything (tags: rails ruby) [...]

#2 Gururaj on 08.31.07 at 12:37 pm

Hi
I tried to install the Ruby and Rails as given above here but i did not able to do it successfully.
So please guide me out on this ASAP

Thanx
Gururaj

#3 angrys0ul on 08.31.07 at 3:44 pm

hello Gururaj, be more specific, tell me what your problem was and at which stage you faced the problem

#4 Vinod on 09.25.07 at 4:07 am

Hi.. first of all there is a small correction….

The parameter LOCAL is followed with 2 dashes not one..

The correct command is
gem install GEMNAME –-local

Then rest of the things as said above in the post

First download all the mentioned GEMS, and place them in a directory.. Go to COMMAND PROMPT.
START -> RUN -> CMD

Then go to the directory where you have placed the GEM files. by using the command CD DIRNAME

Then start using the commands in the order..
GEM INSTALL activesupport –LOCAL
GEM INSTALL activerecord –LOCAL
GEM INSTALL actionpack –LOCAL
GEM INSTALL actionwebservice –LOCAL
GEM INSTALL actionmailer –LOCAL
GEM INSTALL rails –LOCAL

OR else instead of individually giving the command, put them all in one line and issue the command as below.

GEM INSTALL activesupport actionpack activerecord actionwebservice actionmailer rails –LOCAL

Hope this should solve the problem

#5 karthic on 12.27.07 at 12:48 am

Hi
please told how to install ruby on windows xp.it’s to hard to install please help me sir please explain the concept step by step

#6 Hmark on 01.18.08 at 10:16 am

“gem is not recognized as an internal or external command”

Ruby is installed. Gems are downloaded. Any ideas?

#7 albemuth on 01.28.08 at 9:48 am

Hmark, you probably just need to include your ruby\bin in the classpath, check your environment variables

Leave a Comment