It’s hard to do any serious Ruby development on Windows and not come out of it with the distinct feeling of being… overlooked. That may be because most serious Ruby developers work on Macs or Linux desktops, but sometimes it feels like the causality is just the opposite. Nearly every piece of Ruby or Rails documentation starts from the assumption that the reader is not working in Windows. After all, Ruby is Very Cool and Windows just isn’t.
I believe that the end result of this for the Ruby community is that the majority of potential Ruby developers never move beyond “potential” in large part because trying to develop Rails applications on the most common developer operating system is much, much harder than it has to be.
A case in point is debugging and the support for breakpoints in Ruby under windows. This very basic and necessary feature of development broke with the release of Ruby 3 and, despite the gem being open source, hasn’t been fixed in the three years since it was first discovered.
The bug arises from a problem with the gem’s makefile, which is configured to ignore gcc on Windows and instead require Visual C++ 1.53, released in the early 1990s, to be present. There are numerous workarounds for this, including downloading and hacking the makefile (and the solution below,) but it boggles the mind that such an obvious and limiting bug has been allowed to remain extant for so long. It illustrates one of the crucial limitations of FOSS. Bugs usually only get fixed if someone cares enough to fix them.
If you’ve been working in a Ruby IDE like JetBrains RubyMine or Aptana Studio and tried to set a breakpoint, you’ve most likely seen the bug. You attempt to debug a Ruby application and are told that one or more debugging gems is missing. The IDE then offers to install it automatically, but fails to do so.
Here’s the method that has worked for me on several machines.
- Drop to a command prompt with Ruby in the path. If you have a Ruby program group created by RubyInstaller, it will usually contain a specific command prompt icon configured to do just that.
- Type gem install –pre linecache19. If you have the prerequisite gems installed, this will download and install a precompiled version of the linecache gem for Ruby 1.9.x. If it fails because of a missing prerequisite gem, install the prerequisite, then try again. On a new installation, there can be a fair number of these.
- Type gem install –pre ruby-debug19 followed by gem install ruby-debug-ide.
This has worked for me on four PCs running Windows 7 now.