Getting Qt and Ruby (=QtRuby) running on Windows 7 (and Windows XP)

Update 2011-10-16:
Following a very-well written post on stackoverflow, getting QT and Ruby running on Windows 7 is quite easy nowadays.

Quote from

The following steps work on Windows 7:

  1. Install Ruby 1.9.2 via the official download page.
  2. In a Windows shell, run gem install qtbindings.

The trivial example (require 'rubygems'; require 'Qt') should now work.

Hence the tutorial below is now obsolete. However, I will keep it here for reference purposes.


This is an update on a previous tutorial which explained how to write Ruby applications using Qt on Windows XP. This new version is dealing with Ruby applications using Qt on Windows 7 (but it should also work in Windows XP). Also, it uses Qt 4.6.1 instead of Qt 4.3.4 and it also brings a newer version of QtRuby (2.1.0).


Believe it or not: In some QtRuby application I wrote some time ago, somebody discovered a “hidden feature” (let’s not use the b-word here). To remove this “feature” I had to re-install my development environment since in the meantime I got a new laptop (really fancy one with SSD and all, I like it).

Three years ago, getting QtRuby running on Windows was so complicated that it was worth a lengthy  tutorial.
But now it’s 2011. Should be much better now, right?
Turns out, in June 2011 it is so complicated, that dr1ku wrote an even longer tutorial  (no bashing indented, his article is really exhaustive with a lot of insight and information).
Today it is my turn again. Luckily I found a solution that is reasonably simple, but still requires some not-too-obvious steps (at least for a ruby-noob like myself).

So. Here we go again. I wonder what it will be like in 2014.
Oh wait, the end of the world is scheduled for 2012. Phew, that will save us some trouble.


As in the previous installment of this guide, I did not use the latest versions of Ruby/Qt/QtRuby, because they simply don’t work together (as dr1ku points out in his post mentioned above). I will assume that Ruby is not yet installed on your system.

  1. Download and install Ruby 1.8.7-p334.
    Make sure to use the RubyInstaller version. You can find it at rubyforge.During installation, make sure to add ruby to your path.
    Verify the installation by opening a command line and type ruby --version. It should yield:
    ruby 1.8.7 (2011-02-18 patchlevel 334) [i386-mingw32]
  2. Update gems to the latest version by typing
    gem update --system
  3. Install rake (which is a prerequisite for QtRuby)
    gem install rake
  4. Install DevKit (which is a prerequisite for QtRuby)
    Follow the instructions found here.
    Don’t panic: The instruction looks lengthy, but most of the steps are optional or for updating legacy versions of DevKit.
  5. Finally install QtRuby gem. On the command line type
    gem install qtruby4 --remote --platform=mswin32
    The --platform=mswin32 is required to override the platform check of gems.
  6. Verify the installation by opening a command line and type irb (an interactive ruby interpreter)
    Type require 'rubygems' and hit enter. It should yield true.
    Now type require 'Qt' which should also yield true.

Well, that’s it. For getting-started instructions and some more information, please visit the previous installment of this guide  and start reading after “That’s it!”


Where was I? Oh right, that “hidden feature” is still hiding…


3 thoughts on “Getting Qt and Ruby (=QtRuby) running on Windows 7 (and Windows XP)

  1. Pingback: ThisIsNotATest » Blog Archive » Getting Qt and Ruby (=QtRuby) running on Windows XP

  2. admin Post author

    Hi Max!
    Thanks for the information and for the great post on stackoverflow. I updated my tutorial with a reference to your article.
    Let’s hope it stays that simple.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.