Windows + Ruby Native Gems (1.9.1)

A few weeks back I posted about getting the ruby-debug-ide gem installed in Windows under Ruby 1.8.6.  In that post I outlined how hacking a header file and using the Visual C++ 2008 compiler could be leveraged to get the gem built and installed properly.  Well, after a helpful comment from a reader and watching a few screencasts over on TekPub, I actually found a way to do this with Ruby 1.9.1 from RubyInstaller.org.

As you know, I swapped my Windows development environment for Mac OSX, and so far learning Rails has been a great pleasure thanks to Agile Web Development with Rails (Third Edition) from The Pragmatic Programmers.  When I found this alternate method for installing ruby-debug-ide I decided to fire up my Windows 7 VM and give it a go.  Here are the gems I have currently installed on my VM:

ruby-debug-ide-1.9.1

To get this working on my VM, here’s the steps I followed:

  1. Install Ruby 1.9.1 from RubyInstaller.org.  When you run the installer, make sure you pay attention to the checkboxes under the install path and check both of them:
    ruby-installer-associations
  2. Now that you have Ruby installed, you need to get the devkit package from Rubyforge.  You should see an archive in the “Development Kit” section of that page.  The current version as of this writing is 3.4.5r3 (20091110).
  3. Once you have the archive, you’ll need 7-zip to decompress it, so go get it and install it.
  4. When you open the archive in 7-zip, click the Extract button and make sure you extract it to wherever you installed Ruby.  In my case this was C:\Ruby19.
    ruby-devkit-extraction
  5. The last step is to make the devkit fstab file point to the proper Ruby folders.  The fstab file is underneath your Ruby install.  Mine was located at C:\Ruby19\devkit\msys\1.0.11\etc\fstab.  Just open this file in notepad and change it.
    ruby-devkit-fstab
  6. Now the devkit is installed properly, all you have to do is open up a command prompt (make sure you Run As Administrator) and type the following commands (if you want to get the same gems as me):
    gem install rails
    gem install mongrel
    gem install cucumber
    gem install rspec
    gem install ruby-debug-ide

That’s it!  If you run into any weird issues, let me know in the comments.  Enjoy your new Windows-based Ruby on Rails development environment running the latest and greatest Ruby 1.9.1! :)



10 Responses to “Windows + Ruby Native Gems (1.9.1)”

  1. Luis Lavena says:

    Hello Scott,

    Nice write up!

    As developer of RubyInstaller project I would like to add your tutorial to our Wiki page:

    http://wiki.github.com/oneclick/rubyinstaller/tutorials

    For others to find reference in the future about installing the DevKit and installing gems for it.

    Also, compare the your previous post about installation of ruby-debug-ide, seems that the whole scenario has improved, don’t you think?

    Will love to hear your thoughts on this as you now have migrated to other environment and have a better point of comparison.

    Cheers!

  2. Thanks Luis! This is definitely a much better option for most than building from VC++ 2008. I really think the RubyInstaller project is great, and I’m happy to contribute! The only thing you might want to consider is adding the devkit installation as an optional part of the 1.9.x installer (maybe another checkbox or something).

    Thanks for the hard work :)

  3. Eddy says:

    Thanks Scott for this great tutorial… I was lost and I found the path with this information…

  4. Eddy says:

    Could not find main page README.rdoc

  5. Regina says:

    Thank you so much, I have been searching for an article on this for weeks! It’s amazing how information and technology can get the best of us sometimes!

  6. Faiz says:

    excuse me, im was greenhorn about programing world

    i confuse about last step installation ruby at devkit fstab

    what the meaning about statments “Just open this file in notepad and change it”.

    i try to move fstab to the \mingw and \usr\local after that i open command prompt and try to compile but nothing happened just display “ruby: No such file directory — helloworld.rb (LoadError)”

    i try again but still display that..

    please help me i really want to try ruby,,,

  7. 3dd13 says:

    thanks … I was in trouble installing a gem on my windows machine, lucky that i found your article here !!

    some error messages i saw which was actually solved by installing devkit.
    - libcurl not found
    - make not found
    - no make target ruby.h needed by native.so

  8. Mike says:

    This article really saved my butt! Thanks so much for taking the time to document this solution.

  9. devil says:

    hi all,
    I followed the instructions but I am still getting an error when I tried to install ruby-debug-ide:

    C:\Windows\system32>gem install ruby-debug-ide
    Building native extensions. This could take a while…
    c:\Ruby\bin\..\devkit\msys\1.0.11\bin\bash.exe: *** Couldn’t reserve space for c
    ygwin’s heap, Win32 error 0
    ERROR: Error installing ruby-debug-ide:
    ERROR: Failed to build gem native extension.

    c:/Ruby/bin/ruby.exe mkrf_conf.rb
    Building native extensions. This could take a while…

    Gem files will remain installed in c:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-debug-i
    de-0.4.9 for inspection.
    Results logged to c:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.9/ext/gem_
    make.out

    Have got somebody an idea what is the problem and how I can fix that?

  10. [...] to work flawlessly. Luckily Scott Anderson posted a useful trick for debugging native extensions at Geeksharp.com (thanks Scott). You gotta love the ability of hackers to figure something out, and share it with [...]

Leave a Reply