Having played around with InstantRails for a bit I decided I needed to know how to install Ruby on Rails manually. Now I know there are Ruby MSI installers for windows but there's nothing like doing it the long way to get to know and understand what gets installed, where it belongs and if it breaks then you're familiar with the installation.
So here goes...
1. What Do I Download and Where From?
First off go grab these files -
http://rubyforge.org/frs/?group_id=426&release_id=5757 - Ruby 1.8.5http://rubyforge.org/frs/download.php/11290/rubygems-0.9.0.zip - RubyGems 0.9.0http://www.zlib.net/zlib123-dll.zip - zlib 1.2.3http://prdownloads.sourceforge.net/gettext/libiconv-1.9.1.bin.woe32.zip?download - iconv 1.9.1
It's best to create a subfolder in your favourite downloads directory and download these four files to there and then unzip each one individually to it's own folder.
2. Where Do I Put It All?
Rather than deploy into the Program Files folder (spaces in folder names still seems to send the willies up some of these OS projects occasionally) I created a folder in the root of my c: drive called RubyTools. I then copied the unzipped ruby-1.8.5 folder and rubygems-0.9.0 folders to c:\RubyTools.
Just a couple of points here - the Ruby interpreter zip file and uncompressed folder is called ruby-1.8.5-i386-mswin32, I shortened it to ruby-1.8.5 after copying to make typing easier. In Winzip or WinRAR if you 'Extract to \rubygems-0.9.0' rather than 'Extract to here' you end up with an extra subfolder called rubygems-0.9.0...just so you know.
So after copying to my RubyTools folder, this is what my folder structure looks like:
Next copy the zlib1.dll file to your Windows system32 folder and rename it zlib.dll. On my first attempt to install RubyGems (see further on) it crapped out with an error saying it couldn't locate zlib.dll. You may already have zlib installed so try that version first.
Finally copy iconv.dll from the extracted iconv bin folder (.\libiconv-1.9.1.bin.woe32\bin) to your Windows system32 folder. This is a character set conversion library and the Rails project installer will complain if it's not there. Read more about it here http://wiki.rubyonrails.com/rails/pages/iconv.
3. Set Your PATH
Add the path to the ruby.exe executable to your environment PATH variable. If your forgot or don't know how to do this:
Right Click + My Computerclick on the Advanced Tabclick on the Environment Variables button then either -select the PATH variable in the 'System variables' listclick the Edit buttonappend the path to the ruby executable ...or...create a new Environment variable called RUBY and set the path hereappend ;%RUBY% to PATH (you need to include the semi-colon if it's not there already)
4. Install RubyGem Package Manager
Open a command prompt window and change directory the rubygems-0.9.0 e.g. cd \rubytools\rubygems-0.9.0
Type: ruby setup.rb and hit return. You should see something like this from the installer -
C:\RubyTools\rubygems-0.9.0>ruby setup.rb---> bin<--- bin---> lib[snipped for brevity]---> lib/rbconfig<--- lib/rbconfig---> lib/rubygems<--- lib/rubygems<--- librm -f InstalledFiles---> binmkdir -p C:/RubyTools/ruby-1.8.5/bin/install gem C:/RubyTools/ruby-1.8.5/bin/install gemlock C:/RubyTools/ruby-1.8.5/bin/[snipped for brevity]As of RubyGems 0.8.0, library stubs are no longer needed.Searching $LOAD_PATH for stubs to optionally delete (may take a while)......done.No library stubs found.
Successfully built RubyGemName: sourcesVersion: 0.0.1File: sources-0.0.1.gem
C:\RubyTools\rubygems-0.9.0>
And that's the RubyGems package manager installed.
5. Install Rails
Keep the command prompt window open and type: gem install rails --include-dependencies then hit return. You'll then see Gem work it's magic and grab the latest version of Rails (1.1.6 at the time of writing):
C:\RubyTools\rubygems-0.9.0>gem install rails --include-dependencies Bulk updating Gem source index for: http://gems.rubyforge.org Successfully installed rails-1.1.6 Successfully installed rake-0.7.1 Successfully installed activesupport-1.3.1 Successfully installed activerecord-1.14.4 Successfully installed actionpack-1.12.5 Successfully installed actionmailer-1.2.5 Successfully installed actionwebservice-1.1.6 Installing ri documentation for rake-0.7.1... Installing ri documentation for activesupport-1.3.1... [snipped for brevity]Installing RDoc documentation for rake-0.7.1... Installing RDoc documentation for activesupport-1.3.1... Installing RDoc documentation for activerecord-1.14.4... Installing RDoc documentation for actionpack-1.12.5... Installing RDoc documentation for actionmailer-1.2.5... Installing RDoc documentation for actionwebservice-1.1.6... C:\RubyTools\rubygems-0.9.0>
You might get a couple of messages along the lines of -
While generating documentation for activesupport-1.3.1... MESSAGE: Unhandled special: Special: type=17, text="<!-- HI -->"... RDOC args: --ri --op C:/RubyTools/ruby-1.8.5/lib/ruby/gems/1.8/doc/activesuport-1.3.1/ri --quiet lib(continuing with the rest of the installation)
...and...
While generating documentation for actionpack-1.12.5... MESSAGE: Unhandled special: Special: type=17, text="<!-- The header partf this layout -->"... RDOC args: --ri --op C:/RubyTools/ruby-1.8.5/lib/ruby/gems/1.8/doc/actionpak-1.12.5/ri --quiet lib(continuing with the rest of the installation)
This is apparently quite common on Windows platforms and it doesn't seem to affect anything from what I could google.
So we're done with the install bit, next time we test our Rails installation to see if it hangs together.
Remember Me
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.