published on 02.04.2006 19:56.

getting irb brackets to work on german windows

for those on windows, there’s the great ruby one-click installer which will set up a nice ruby environment on your box. asking it to take care of all possible localization issues would be asking for too much though, so if you’re on a non-english windows, chances are that irb will be severely broken – no brackets, no ruby joy. and no script/console in ruby on rails.

the reliable way

here’s how i was able to fix the issue:

  • download the file linked to in why’s poignant guide to ruby in the “windows hickups” sidebar. place the files from the zip file in ruby directories as described at why’s.
  • get the text snippet “for europeans” as well. save it to the file c:\ruby\etc\.inputrc_german. (you will have to create the etc directory first). when saving the file you might have to go through the windows shell, as the windows explorer doesn’t let you create filenames starting with a dot.
  • tell readline where to find this file. the safest bet is to directly point at the file by setting the INPUTRC environment variable. so edit c:\ruby\bin\irb.bat and insert the following after the @echo off command (line 2):
    set INPUTRC=c:\ruby\etc\.inputrc_german

the pretty way

if you don’t want to “hack around” your ruby directory and modify irb.bat, of course you can specify the environment variable somewhere else and also put the .inputrc file in another directory. these are your options (start reading from the paragraph “Readline-4.0 will look for an …”).

i fiddled with this a lot, so i came up with the first option. if you want to put the file somewhere else, be aware of the following:

  • the HOME env variable is most likely not set on windows, so readline will not search there.
  • if the path to .inputrc contains spaces (as it will when pointing to a german windows home dir - “C:\Dokumente und Einstellungen...”) readline might choke. at least it didn’t work on my box.
  • if you happen to have cygwin installed (as i do …) there’s some extra confusion, as the HOME env variable is set, but it points to some place that (at least on my system) does not exist.

Posted in ,