Installing Ruby, Ruby on Rails, MySQL and Rmagick on Windows

Installing Ruby Language Support

  1. Install Ruby using the Ruby one click installer -

As of the writing of this article, 1.8.5-21 is the latest version. There have been problems reported in using ruby 1.8.5-21 with the latest versions of edge rails. I can safely say that using 1.8.4-20 which is also available for download will be your best bet.

Installing Ruby Gems:

To use the Ruby Gems Package Manager open a cmd window and then enter the gems command. Or you can create the gemhelp.cmd file which has only one line in it, cmd /k gem or download it from.

Installing Ruby on Rails for Windows

(see also Getting Started With Rails)

 

  1. install rails gem (and all its dependencies)
    gem install rails --remote --include-dependencies
  2. When doing an upgrade, this should work:
    gemupdate --remote --version rails

Salted Hash Login & Authentication Generator

(see also Salted Login Generator Quick Start)

 

  1. install salted login generator gem
    gem install --remote salted_login_generator
  2. install localization gem
    gem install --remote localization_generator
  3. Iconv is a library used for charset conversion and required by the Salted Hash Login Generator. Download this iconv package with simple installation instructions, unzip the package, and run the installer.
    C:\tmp\iconv>setup  Setup has detected Ruby at c:\devel\ruby  and Windows/System32 at C:\WINDOWS/System32  Install Iconv there? [yN] y  cp iconv.so c:\devel\ruby/lib/ruby/1.8/i386-mswin32  cp iconv.dll C:\WINDOWS/System32  cp charset.dll C:\WINDOWS/System32  Installation successful.

    Update, the above iconv package link no longer works. Instead you have to follow the more laborious task of getting iconv.so and installing it in ruby\lib\ruby\1.8\i386-mswin32 and getting iconv.dll and installing it in C:\WINDOWS\System32. More detailed instructions can be found on the iconv in Ruby on Rails page.

RMagick

(see also RMagick Install FAQ)

 

You'll find you most likely need to download the rmagick windows gem directly from the rubyforge site. If you don't, you may end up wth an error such as this one:

gem install rmagick
<p>gem_extconf.rb:38: undefined method `exitstatus' for nil:NilClass (NoMethodError)
  ERROR:  While executing gem ... (RuntimeError)
ERROR: Failed to build gem native extension.
Gem files will remain installed in c:/ruby/lib/ruby/gems/1.8/gems/rmagick-1.13.0 for inspection.
ruby gem_extconf.rb install rmagick\n
sh configure

Instead, go into unzipped directory and do a local gem install

 

  1. Download latest RMagick Windows gem ZIP archive from http://rubyforge.org/projects/rmagick/
  2. Unzip Windows gem archive
  3. go into unzipped directory and do a local gem install
    C:\tmp\RMagick-1.9.1-IM-6.2.3-win32>gem install RMagick-win32-1.9.2-mswin32.gem
  4. run post installer
    C:\tmp\RMagick-1.9.1>postinstall  RMagick 1.9.2 win32 Post Installation (see enclosed README for license information)  detecting available fonts, writing to config/type-windows.xml.
    
    setting MAGICK_CONFIGURE_PATH to 'c:/devel/ruby/lib/ruby/gems/1.8/gems/RMagick-win32-1.9.2-mswin32/config'.  setting is only for current user.  
    
    Copying 5 dlls to c:/devel/ruby/bin...done.  all done.

MySQL

  1. Install MySQL 5.0+ (use the Windows Essential installer)

SQL Administration:

With rails migrations, there's not a lot of need for SQL admin tools for creating your tables and setting up your database. The very basics can be done from the command line in a few lines at the most, but if you feel the need to have a SQL admin tool for Windows, here's a few:

phpMyAdmin - This is a formidable and popular web based MySQL administration tool. Download phpMyAdmin package. You can also look at Navicat and SQLYog for desktop applications admin tools.

Ruby on Rails IDE (Editor)

Last but not least, you'll want to get yourself an IDE for editting your ruby on rails projects and having helpful code-completion, log tailing analysis and generators built in to create your models and controllers! Go grab yourself a copy of RadRails and you'll find it can do all of this for you.

Concluding this tutorial

You may want to look at the tutorial for gems I also install to get an idea of other useful ruby gems you can benefit from having. Hopefully this helps!