no such file to load — readline (LoadError) when running script/console
Ruby on Rails, Ubuntu/Linux Add commentsIf you get
Loading development environment (Rails 2.3.2)
/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
when running script/console, you might be missing some libraries after you’ve installed Ruby from source. So you might try (Ubuntu, Debian):
sudo apt-get install libncurses5-dev
sudo apt-get install libreadline5-dev
Then cd to the folder with your unpacked Ruby sources, subfolder ext/readline:
cd /usr/src/ruby-1.8.7-p72/ext/readline
ruby extconf.rb
make
sudo make install
There is no need to recompile Ruby. If you get any of these:
checking for tgetnum() in -lncurses… no
checking for tgetnum() in -ltermcap… no
checking for tgetnum() in -lcurses… no
checking for readline/readline.h… no
checking for editline/readline.h… no
you’re still missing libraries so re-check if the apt-get commands above completed without errors. Hope it helps.
April 15th, 2009 at 4:19 pm
[...] a good how-to at dirk.net (it’s really simple), but if like me you’re using CentOS rather than some version of Debian, then [...]
May 27th, 2009 at 1:04 am
Thank you for the hint! Worked fine with my self compiled rails on Debian Lenny.
January 10th, 2010 at 7:56 am
It’s all fun and games until someone compiles from source. Thank you for the tip!
January 23rd, 2010 at 12:51 pm
Thank you it worked !!
February 1st, 2010 at 1:32 pm
Thank you, sir. Worked like a charm!