Ruby readline Error

One of the things I don't like about using open source is that it often craps out on you. This happened to me recently when running the Rails console. This is the error that I received and the steps to solve the problem:

# script/console
Loading development environment.
/usr/local/lib/ruby/1.8/irb/completion.rb:10:in 'require': no such file to load -- readline (LoadError)
        from /usr/local/lib/ruby/1.8/irb/completion.rb:10
        from /usr/local/lib/ruby/1.8/irb/init.rb:252:in 'require'
        from /usr/local/lib/ruby/1.8/irb/init.rb:252:in 'load_modules'
        from /usr/local/lib/ruby/1.8/irb/init.rb:250:in 'each'
        from /usr/local/lib/ruby/1.8/irb/init.rb:250:in 'load_modules'
        from /usr/local/lib/ruby/1.8/irb/init.rb:21:in 'setup'
        from /usr/local/lib/ruby/1.8/irb.rb:54:in 'start'
        from /usr/local/bin/irb:13

So, it seems that readline is not installed even though the yum package manager reveals that it is already installed (yum search readline). BUT WAIT! Then I remember that there is often a xxxx-devel package that needs to be installed when compiling things! Let's try that:

# yum install readline-devel

Now it's time to re-build that readline extension:

# cd /path/to/ruby-1.8.6/ext/readline/
# ruby extconf.rb
# make
# make install

That's it!


About this entry