Topic: Script/Console error: no such file to load -- readline (LoadError)

Hi Rails Forum,

I have finally gotten around to troubleshooting this since it was on the bottom of my list of stuff to fix.

When I type script/console, I get this error:

[root@trebek2 readline]# /usr/local/bin/myapp/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

I tried doing the fix as outlined here but to no avail: http://wiki.rubyonrails.org/rails/pages/ReadlineLibrary

According to this article, it seems I am missing some code for the readline library.

Is there a way to reinstall readline using gems? Any suggestion to fix this are more than welcome.

thanks

jackster

Re: Script/Console error: no such file to load -- readline (LoadError)

I'm not familiar with your particular problem, but a quick google search located this.
http://www.oobaloo.co.uk/articles/2006/ … -and-rails

as you didn't mention your o/s I can't say for certain this would apply to you(linux only)

Re: Script/Console error: no such file to load -- readline (LoadError)

My solution on Ubuntu Linux is:
* install libncurses5-dev package
* make the readline module for ruby,
  i.e. go to the <ruby_src>/ext/readline,
  ruby extconv.rb    #generate valid makefile
  make
  make install

<rails_prj>/script/console will prompt no error!

Re: Script/Console error: no such file to load -- readline (LoadError)

Surely the proper way to fix this is look at the output from running

"ruby extconv.rb" in the <ruby_src>/ext/readline as suggested above.  That will tell you what is required to compile readline.

On my system Ubuntu (Hardy 8.04) I required libncurses5-dev and libreadline5-dev (installed with apt-get install <package-name>.

Re-run "ruby extconv.rb" and it will show you whether anything else is missing, or create a makefile.  Once you have your makefile, run make, then make install.

Re: Script/Console error: no such file to load -- readline (LoadError)

On Centos 5.5 you need to install the following:
yum install ncurses-devel readline-devel
cd <ruby_src>/ext/readline
ruby extconf.rb
make && make install

Re: Script/Console error: no such file to load -- readline (LoadError)

If you are using RVM on Centos, you will need to do:

yum install ncurses-devel readline-devel
rvm install ruby-<version>

If you had ruby-<version> already installed, uninstall it, then reinstall it.