home

Installing Ruby on Rails on Windows

Buy Himcolin No Prescription Tenormin No Prescription Chitosan For Sale Buy Requip Online Buy Online Soma Buy Vasotec No Prescription Proventil No Prescription Zoloft Ultram For Sale Buy Lukol Online Buy Online Lexapro Buy Ultram No Prescription Styplon No Prescription Imitrex For Sale Buy Lincocin Online Buy Online Coumadin Buy Accutane No Prescription Prozac No Prescription Calan For Sale Buy Tentex Royal Online Buy Online Emsam Buy Snoroff No Prescription Lasuna No Prescription Brafix For Sale Buy Toprol XL Online Buy Online Kytril

UPDATE: Instructions updated for Rails 2.3.2 and SQLite.

Ruby on Rails isn’t the easiest install on the Windows Platform (the official instructions are light on the Windows side). Perhaps it’s because most active development is done on the Mac and Linux platforms, and that deployment (production environments, tools like capistrano, and source control systems) is targeted for the Mac and Linux platforms also.

But, if you must to use a Windows Box, here’s how to install Ruby on Rails.

Step 1: Install Ruby
Step 2: Install RubyGems
Step 3: Install Rails
Step 4: Install a Database and Ruby Bindings for Database
Step 5: Test the Installation

Step 1: Install Ruby

First, you’ll need Ruby. Visit http://www.ruby-lang.org/ and hit the downloads page. You’ll want to download the one-click installer:

Windows XP Professional
Uploaded with plasq’s Skitch!

Run the Installer with all the defaults, including installing into C:/ruby

This will setup your PATH and ensure that Ruby is installed correctly.

Step 2: Install RubyGems

The one-click installer ships with an older version of RubyGems, but the easiest way to update (unfortunately) is to download and manually install the newest.

Visit the official RubyForge RubyGems download page http://rubyforge.org/frs/?group_id=126 and download the latest (as of this writing 1.3.1) zip file:

Windows XP Professional
Uploaded with plasq’s Skitch!

After downloading, unzip the file somewhere (temporary). Open up Command Prompt (Start -> Programs -> Accessories -> Command Prompt or Start -> Run and then run “cmd.exe”) and change into the directory where you unzipped the files.

Run the setup using:

ruby setup.rb

Here’s a screenshot:

Windows XP Professional
Uploaded with plasq’s Skitch!

Step 3: Install Rails

Install Rails using Rubygems.

Open up Command Prompt (Start -> Programs -> Accessories -> Command Prompt or Start -> Run and then run “cmd.exe”) and run the command:

gem install rails

Note: It doesn’t matter what directory you’re in when you run this command.

If you have a web proxy (because you are behind a corporate firewall or proxied server), you will need to append the -p or –http-proxy command:

gem install rails -p http://yourproxy.example.com/

or

gem install rails –http-proxy http://yourproxy.example.com/

This should install several other gems.
Here’s a screenshot:

Windows XP Professional
Uploaded with plasq’s Skitch!

Step 4: Install a Database and Ruby Binding for Database

Option 1: SQLite3

To install SQLite3, a lightweight database, all you need to do is put the sqlite.exe file somewhere in your PATH. To build the ruby bindings for the SQLite3 database, though you’ll need the DLL. Visit http://sqlite.org/download.html and scroll down to “Precompiled Binaries for Windows” to download the “command-line program” (usually the first link) and the “DLL of the SQLite library without the TCL bindings” (usually the third link). At the time of this writing, those files were sqlite-3_6_11.zip and sqlitedll-3_6_11.zip respectively.

Download those files and unzip both of them. Copy all of the contents from both files to somewhere in your path (the C:/ruby/bin directory is an excellent location to unzip these files).

Once you have done this, you can now install the SQLite3 ruby bindings by once again opening up a Command Prompt (Start -> Programs -> Accessories -> Command Prompt or Start -> Run and then run “cmd.exe”) and running:

gem install sqlite3-ruby -v 1.2.3

or

gem install sqlite3-ruby –version 1.2.3

Note: You must install version 1.2.3 if you are on Windows. The latest version as of this writing (1.2.4) does not install on Windows without attempting to build using a C compiler. If you have a copy of MS Visual Studio and the build tools, feel free to install 1.2.4, but the 1.2.3 contains pre-built x86 targeted windows binaries, and works fine.Once again, if you have a proxy server (see above), you will need to append the -p or –proxy-http command:

gem install sqlite3-ruby -v 1.2.3 -p http://yourproxy.example.com/

or

gem install sqlite3-ruby –version 1.2.3 –proxy-http http://yourproxy.example.com/
Windows XP Professional
Uploaded with plasq’s Skitch!

Option 2: MySQL
Please see the Internets (google) for how to install the latest version of MySQL and the Ruby MySQL gem.

Step 5: Test the Installation

Open up a Command Prompt (Start -> Programs -> Accessories -> Command Prompt or Start -> Run and then run “cmd.exe”) and run the command:

ruby -v

You should see the version of Ruby you installed.

Run the command:

gem -v

You should see the version of RubyGems you installed.

Run the command:

rails -v

You should see the version of Rails you installed.

To create a test Rails application, run the following:

rails testapp

This should create the skeleton of a Rails application. Change into the directory using:

cd testapp

Boot up the server by running the server in the script directory:

ruby script/server
Windows XP Professional
Uploaded with plasq’s Skitch!

This should start the server on port 3000. You can use Internet Explorer (or Firefox perferred), to visit:

http://localhost:3000/ or http://0.0.0.0:3000/ or http://127.0.0.1:3000/ depending on how your network is configured.

If you click the “About your application’s environment link” you will know that Rails is working and installed properly.

Windows XP Professional
Uploaded with plasq’s Skitch!