Building Ruby 1.9.2 with readline support on Fedora

If you compile Ruby 1.9.2 on Fedora, you may notice that readline does not work. The symptom appears when you use irb: pressing the up arrow does not cycle through previous lines. It just prints [A.

To fix this, make sure you have the readline-devel package installed. If not, run

yum install readline-devel.i686

While you’re at it, you should also make sure that the following packages are installed:

  • bison
  • zlib-devel
  • openssl-devel

Switch into the directory that contains your downloaded ruby source, and run the following:

make clean
make install

Now switch into <ruby_source_dir>/ext/readline, and run the following:

ruby extconf.rb
make install

Try running irb now, and the arrow and tab keys should work as expected.