June 15, 2007

How to switch off the broken ruby readline on Windows

It took me > 2 hours to remember this from machine A to new machine B just recently so here goes:

Ruby on Windows ships (many versions, any way) with a broken readline used in irb and rails console sessions. The upshot of the broken readline is that the characters { [ ] } and | are not available - which makes it kind of hard to use blocks...
The trick is this:
In your .irbrc file in c:\Documents and Settings\Your Name (make one if it isnt there) put the single line

IRB.conf[:USE_READLINE] = false

and your console sessions should become more satisfying

UPDATE: Hmm - through the unbelivable idiocy of the ruby distro on windows, ruby actually does NOT read this .irbrc on its own, and I haven't found a solid default interpretation of ~ or HOME or HOMEPATH elsewhere on win32 ruby either
You have to
set IRBRC=c:\Documents and Settings\Your Name\.irbrc
No, placing it with the ruby interpreter itself doesn't help either

Posted by Claus at June 15, 2007 3:58 PM
Post a comment