compiling readline into an existing Ruby installation

Yesterday I ran into a problem on a existing Ruby installation on a Centos server. When I tried to access script/console, I got the following error:

require’: no such file to load — readline (LoadError)

Doh! Turns out, the solution is to simply compile readline again.

So you need to download Ruby again:

wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p72.tar.gz

extract it:

tar xvfz ruby-1.8.7-p72.tar.gz

and we’ll compile it:

cd ruby-1.8.7-p72/ext/readline/

ruby extconf.rb
sudo make
sudo make install

If you face any error related to readline-devel while compiling readline, it can be solved by installing readline-devel:

sudo yum install readline-devel

And that’s it. Readline working again and script/console too.

Tags: , ,


2 Responses to “compiling readline into an existing Ruby installation”

  1. mariano March 18, 2009 at 2:13 pm #

    Thanks! It worked as a charm!

  2. Xavier Riley March 22, 2011 at 5:52 pm #

    Thanks man. For anyone on cpanel, the folder for me was /home/cprubybuild/ruby-1.8.7-p174

Leave a Reply