Thursday, January 31, 2008

Solving ruby script/console "no such file to load -- readline" error

(These instructions are for Ubuntu for the error given below)
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

1. apt-get install libreadline-ruby
2. apt-get install libreadline-dev
3. cd to where your downloaded source for ruby is located. (say ~/installed-software/ruby-1.8.6.tar.gz)
4. cd to ruby-1.8.6
5. run ./configure
6. run make
7. run make install
While running make, while the lines are streaming by, you will be able to notice 'compiling readline'.
8. try ruby script/console from your app dir. It should load it this time.

6 comments:

Anonymous said...

You don't have to completely rebuild ruby. From your ruby source directory:

cd ext/readline/
ruby extconf.rb
make
sudo make install

Anonymous said...

Thanks ya'll
I can confirm that the previous post works (a complete ruby rebuild was not nessary.)

I was however missing libreadline-dev and had to install it using apt-get.

roger said...

ubuntu should have come with it :)

Anonymous said...

just ran into the same on Debian 2.6.7 with ruby 1.8.6/rails 2.0.2
and I'm learning how to build a secure web app with eclipse 3.1

the shortcut worked for me too!

thanks

Anonymous said...

thanks. this really helped :-)

John Trupiano said...

Thanks, this helped. I can't count on two hands the number of times I've had to search for the exact apt-get packages.