Sunday, July 08, 2007

Installing Ruby on Rails on Windows Vista

Ruby? Rails? Keretapi Tanah Melayu? Doesn't make sense? http://www.rubyonrails.org for explanation.

If you are new to ROR and want to find out about installing it on Windows, here it goes.

Before that, here are some other tutorials for your reference.
But the above URL uses those all-in-one installers. I hate those all-in-one installers. Where is the fun? So, this tutorial is for those developers who are looking to install each package separately.

Actually the steps are outlined at http://www.rubyonrails.org/down. Just follow them. Also, I didn't thought of screen capturing the installation. So most of the steps here are text based.

Step 1: Downloads all the necessary stuff

Step 2 : Install
  • Run ruby186-25.exe. It will do all the installation. Just sit tight. Once its done, go to your search box and type in cmd. Once the command prompt screen pops up, type this "cd c:\ruby\bin" (I assume you have installed Ruby in C drive). Then type "ruby -v". If you have installed correct, it will show the version. If not, you have to reinstall Ruby again.


  • Excellent. Now lets install RubyGem. Unzip rubygems-0.9.4.zip. Click on setup.rb. The setup will run in command window.
  • Once done, now you need to run post-install.rb. This will create the RUBYOPT environment variable to the value rubygems in Windows. More information at http://docs.rubygems.org/read/chapter/3.
  • Well, we are done with RubyGem, now Rails. Open the command prompt window. Type "c:\ruby\bin ". Now type this "gem install rails --include-dependencies". What happens now that it will fetch the latest Rails framework from http://gems.rubyforge.org/ .
  • Don't worry if its slow and looks like its hanged, its downloading. There is a standalone package, but I haven't tried installing it that way. Once done you will see the screen as below (look at the 3rd last line in the screen):-

Step 3: Create and Run!
  • To create your application, open up the command prompt. Assuming its at D drive, type "D:\", then "mkdir projects", then "cd projects", then "rails myfirstproject". (You can replace the word "myfirstproject" with any words of your choice. Rails will create all the file structure for you.
  • Then type "cd myfirstproject" if you are not in the newly created directory. Then type "ruby script/server". This will boot up WEBrick web server. Btw, don't close this windows as it will shutdown your webserver.
  • Type in http://127.0.0.1:3000. Tada! You have your Ruby application up and running. Well almost....

  • There are additional steps, however you can refer to section IV of http://allaboutruby.wordpress.com/2006/01/09/installing-rails-on-windows-step-by-step-tutorial/.
Enjoy your ROR!


5 comments:

Anonymous said...

Thanks for this guide!

I really needed a clear step-by-step guide in setting up my very 1st ROR installation in Vista.

You saved me! ^^

Anonymous said...

hi,

Thank you for the post. Where do i find the post-install.rb file, i do not seem to find it and i get rails is not a recognized command when trying to create a rails app.

Thank you

Anonymous said...

Thanks, it was SO easy!!

ambi said...

when i run ruby script I see the following error, Pls help:

"ruby: No such file or directory -- script "

Admiral Adney said...

I was seeking for ruby on rails company and set down up on your mail and i should state thanks for distributing such helpful information.