Installing Ruby on Windows 7 – Ruby 1.9.x Guide

Ruby LogoThis is a step by step guide on installing and using Ruby language on Windows 7 machines. A lot of applications now use the 1.8.x branch of Ruby. However it is being deprecated and if you are starting Ruby programming, you should start with the 1.9.x branch. This tutorial covers Ruby 1.9.3, the latest production release available as of writing this post.

Ruby 1.9.x introduces a number of key language improvements, faster execution and integrated library/package management using ruby gems. However the migration of tools and packages to Ruby 1.9.x is still on going and getting the language up and running with a decent IDE on Windows requires some effort. A large number of developers including the core Ruby developers use Linux or Mac systems for Ruby development and hence much of the documentation available focuses on installing Ruby on these platforms.

Installing Ruby on Windows 7

Ruby language is available as open source and ideally you should download the source code and compile it in your development platform to install Ruby. Luckily on Windows, Ruby is available as an installer. Download the latest Windows installer for Ruby from this page.  In this tutorial, I use Ruby 1.9.3-p0 and the download size is around 15MB. Click on the downloaded file to start Ruby installation.

Ruby Installation - License Terms

Accept license agreement and click on Next.

Ruby Installation - Options

Enable the "Install Tcl/Tk support" if you are planning to create GUI applications in Ruby. Also select "Add Ruby executables to your path". This enables you to invoke Ruby interpreter or programs from any command window. Click on Install to complete Ruby installation.

Exploring Windows Ruby Installation

Ruby - What is installed in WindowsExpand the Windows => Start => All Programs => Ruby 1.9.3-p0 to check whether Ruby is successfully installed. You will find the following items in the menu,

  • Interactive Ruby – This opens a command line Ruby interpreter session.
  • RubyGems Documentation Server – The starts an HTTP server by default listening on port 8808. The documentation for all the gems installed in your Ruby installation can be viewed by accessing this URL – http://localhost:8808/
  • Start Command prompt with Ruby – This opens a standard Windows command prompt with ruby’s programs available in the path environment variable. Type in the command ruby -v in the command line if you want to verify this.
  • Uninstall Ruby 1.9.3-p0 – Get rid of Ruby if you are bored with it
  • Documentation – Complete Ruby documentation including the documentation for core and standard library is available as a windows help file. Also included is a free PDF book titled "The Book of Ruby" written by Huw Collingbourne.

Selecting an IDE for Ruby Programming in Windows

Following are some of the IDEs commonly used in Windows for Ruby programming.

I prefer Aptana Studio 3 for writing Ruby programs in Windows. It has all the cool features you require when you write Ruby programs,

  • It is free!
  • Supports syntax highlighting
  • Integrated Ruby debugger!
  • Code assist and auto completion
  • Code outline (classes, modules and methods)

Installing Aptana Studio as Ruby IDE in Windows

Download the standalone Windows installer for Aptana Studio 3 from this link. If you already have Eclipse 3.5 or above installed, you can alternatively install just the Aptana plugin to enable Ruby support in Eclipse. However I prefer the standalone version. The download is about 140MB.

Double click on the downloaded installer.

Installing Aptana Studio 3

Select a destination folder for Aptana Studio and click on Next.  Choose defaults for the start menu options in the next screen and click on Next. Select file associations in the screen and click on Next and then click on Install to complete the installation. Installation may take a while since a large number of files are extracted.

Aptana Studio requires a Git version control system installation on your system for its scripting features. Thankfully it can also install a private copy of PortableGit for this purpose. When you start Aptana for the first time, you will be presented with the following screen.

Aptana Studio 3 - PortableGit Installation

Click on "Use PortableGit" button.

Aptana uses the concept of workspaces (from Eclipse) which by default is the location for all the projects you create. You can create the default workspace location from the menu, File => Workspaces => Other. If you select another workspace, you will need to configure PortableGit again. Also the workspace folder by default takes over 150MB of hard disk space including PortableGit!

To develop a Ruby program, Click on File => New => Ruby Project option from Aptana Studio. Let us create a simple Hello World program. We will create a project and then add our program to this project.

Creating a new Ruby Project in Aptana Studio 3

Enter the name of the project as "helloworld" and click on Finish. An empty project will be created in the workspace. From the App explorer or the Project explorer, right click and click on  New => File.

Creating a Ruby program in Aptana Studio 3

Type in the name of the file as helloworld.rb and click on Finish. Now you have an empty Ruby program in your project. Open helloworld.rb and type in the following program,

puts "hello world!"

hello world output in Aptana Studio 3Save helloworld.rb and from Aptana menu, click on Run helloworld.rb. You will see the output of the program in the console window of Aptana. However if you try to debug the program from Aptana, you will get the following error,

Unable to find ‘rdebug-ide’ binary script. May need to install ‘ruby-debug-ide’ gem, or may need to add your gem executable directory to your PATH (check location via ‘gem environment’).

In order to debug Ruby programs Aptana requires the ruby-debug-ide gem. Ideally this should be a simple step, but as of writing this blog post, installing it requires a bit of effort.

Enabling Ruby Debugging Support in Aptana Studio 3

In order to debug Ruby programs in Aptana, the ruby-debug-ide gem is required. Installing the gem is a simple step. Run the following command from the command line (requires an active internet connection),

gem install ruby-debug-ide --platform=ruby

However this throws up the following error,

C:\jjc\tools\Ruby193>gem install ruby-debug-ide
Fetching: ruby-debug-ide-0.4.16.gem (100%)
ERROR:  Error installing ruby-debug-ide:
        The ‘ruby-debug-ide’ native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from ‘’ and follow the instructions
at ‘’

This means that I need to install Ruby development kit. This kit is required if you want to build native RubyGems from the source code.

Download the DevKit compressed file from the Rubyinstaller download page. I downloaded DevKit-tdm-32-4.5.2-20110712-1620-sfx.exe (20MB+ ). This is a 7zip self extracting archive. Run the program and choose a directory where you want DevKit to be installed. I  keep it as a subfolder under the Ruby folder.

Open a windows command prompt and change the directory to the DevKit folder.  Type the following command to configure DevKit installation.

ruby dk.rb init

This command will identify the Ruby installed by RubyInstaller as shown below.

Configuring DevKit for Windows

Now run the following command to enable DevKit for the Ruby installations in your machine.

ruby dk.rb install

For more details on the DevKit installation, check this page.

Now try installing the ruby-debug-ide gem from the command line. (Note: this step took a couple of minutes in my machine)

gem install ruby-debug-ide --platform=ruby

What I got is another set of errors (see below)! The problem is that the latest release version of ruby-debug-ide (4.16) cannot be built with Ruby 1.9.x.

Temporarily enhancing PATH to include DevKit…
Building native extensions.  This could take a while…
ERROR:  Error installing ruby-debug-ide:
        ERROR: Failed to build gem native extension.

        C:/jjc/tools/Ruby193/bin/ruby.exe mkrf_conf.rb
Building native extensions.  This could take a while…
Building native extensions.  This could take a while…

Gem files will remain installed in C:/jjc/tools/Ruby193/lib/ruby/gems/1.9.1/gems
/ruby-debug-ide-0.4.16 for inspection.
Results logged to C:/jjc/tools/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0

installing ruby-debug-ide

This bug is already fixed in the latest source code of ruby-debug-ide. However it is not yet a release version. So we need to tell the gem tool to download and install the latest pre release version by passing the –pre command line switch.

gem install ruby-debug-ide --platform=ruby --pre

This installs latest pre release version of ruby-debug-ide (version 0.4.17.beta8 as of writing this blog post).

installing ruby-debug-ide

This will enable the debugging feature in Aptana Studio. Check the debugging feature by setting a break point on your program and then clicking on the debug icon. Now you are all set for developing Ruby programs in Windows!

7 Responses to “Installing Ruby on Windows 7 – Ruby 1.9.x Guide”

  1. […] need to have Ruby 1.9.x installed and the Ruby bin folder must be on the PATH environment variable. See this tutorial for step by step instructions on installing Ruby in Windows. cmd /K ruby […]

  2. Hi, I have been having issues installing ruby-debug-ide19 with 1.9.3. The error I was getting was around a missing file vm_core.h. I tried installing using the instructions you provided but now I get a new error. Have you seen this before?

    C:\Ruby193\DevKit>gem install ruby-debug-ide –platform=ruby –pre
    Temporarily enhancing PATH to include DevKit…
    Building native extensions. This could take a while…
    ERROR: Error installing ruby-debug-ide:
    ERROR: Failed to build gem native extension.

    C:/Ruby193/bin/ruby.exe mkrf_conf.rb
    undefined method `full_name’ for nil:NilClass
    C:/Ruby193/lib/ruby/1.9.1/rubygems/dependency_installer.rb:136:in `block in gather_dependencies’
    C:/Ruby193/lib/ruby/1.9.1/rubygems/dependency_installer.rb:136:in `map’
    C:/Ruby193/lib/ruby/1.9.1/rubygems/dependency_installer.rb:136:in `gather_dependencies’
    C:/Ruby193/lib/ruby/1.9.1/rubygems/dependency_installer.rb:267:in `install’
    mkrf_conf.rb:25:in `rescue in ‘
    mkrf_conf.rb:20:in `’

    Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta8 for inspection.
    Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta8/ext/gem_make.out

  3. Please help with the following error when i’m trying to install ruby debug gem using aptana terminal over windows 7:
    ERROR: While executing gem … (TypeError)
    can’t convert NilClass into String

  4. I got past the final errors shown in this post and have installed ruby-debug-ide-0.4.17.beta9. When I try to launch a ruby file in debug mode I get a new error in the Console:

    c:/Ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require’: cannot load such file — ruby-debug-base (LoadError)
    from c:/Ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require’
    from c:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta9/lib/ruby-debug-ide.rb:5:in `’
    from c:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta9/bin/rdebug-ide:17:in `require_relative’
    from c:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta9/bin/rdebug-ide:17:in `’
    from c:/Ruby/bin/rdebug-ide:19:in `load’
    from c:/Ruby/bin/rdebug-ide:19:in `’

  5. I did this and it install beta9 but then I get this error when I try to run ‘Debug Server’

    c:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require’: cannot load such file — ruby-debug-base (LoadError)
    from c:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require’
    from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta9/lib/ruby-debug-ide.rb:5:in `’
    from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta9/bin/rdebug-ide:17:in `require_relative’
    from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta9/bin/rdebug-ide:17:in `’
    from c:/RailsInstaller/Ruby1.9.3/bin/rdebug-ide:23:in `load’
    from c:/RailsInstaller/Ruby1.9.3/bin/rdebug-ide:23:in `’

    seems like the error line is: require ‘ruby-debug-base’

    so while it looked like gem install for pre worked that aptana cant find it when running in debug

  6. Just thought id say thanks. Im a total programming oob. Noob to html for that matter so its not going smoothly. Spent 8hours trying to get the right setup between aptana and rubymine so I can try and practice/learn a bit and tried many different approaches to install everything, this debug fix you provide was the last bit, and saved me hours im sure.

  7. hi, I followed your steps to install the ruby-debug-ide,but that when I start debug,I got these messages:
    d:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require’: cannot load such file — ruby-debug-base (LoadError)
    from d:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require’
    from d:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta14/lib/ruby-debug-ide.rb:5:in `’
    from d:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta14/bin/rdebug-ide:17:in `require_relative’
    from d:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta14/bin/rdebug-ide:17:in `’

    Could you help me?

Leave a Reply