When I want to execute Rails 3 console, it throws this:
$ script/rails c
/usr/local/rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/irb/completion.rb:9:in `require': no such file to load -- readline (Load Error)
I tried to install libreadline-dev
:
$ sudo wajig install libreadline-dev
Leyendo lista de paquetes... Hecho
Creando árbol de dependencias
Leyendo la información de estado... Hecho
Se instalarán los siguientes paquetes extras:
libncurses5-dev libreadline6-dev
Se instalarán los siguientes paquetes NUEVOS:
libncurses5-dev libreadline-dev libreadline6-dev
0 actualizados, 3 se instalarán, 0 para eliminar y 6 no actualizados.
Necesito descargar 1799kB de archivos.
Se utilizarán 7266kB de espacio de disco adicional después de esta operación.
¿Desea continuar [S/n]?
Des:1 http://mx.archive.ubuntu.com/ubuntu/ lucid/main libncurses5-dev 5.7+20090803-2ubuntu3 [1564kB]
Des:2 http://mx.archive.ubuntu.com/ubuntu/ lucid/main libreadline6-dev 6.1-1 [234kB]
Des:3 http://mx.archive.ubuntu.com/ubuntu/ lucid/main libreadline-dev 6.1-1 [904B]
Descargados 1799kB en 3seg. (477kB/s)
Seleccionando el paquete libncurses5-dev previamente no seleccionado.
(Leyendo la base de datos ... 00%
225006 ficheros y directorios instalados actualmente.)
Desempaquetando libncurses5-dev (de .../libncurses5-dev_5.7+20090803-2ubuntu3_i386.deb) ...
Seleccionando el paquete libreadline6-dev previamente no seleccionado.
Desempaquetando libreadline6-dev (de .../libreadline6-dev_6.1-1_i386.deb) ...
Seleccionando el paquete libreadline-dev previamente no seleccionado.
Desempaquetando libreadline-dev (de .../libreadline-dev_6.1-1_i386.deb) ...
Procesando disparadores para man-db ...
Procesando disparadores para install-info ...
Configurando libncurses5-dev (5.7+20090803-2ubuntu3) ...
Configurando libreadline6-dev (6.1-1) ...
Configurando libreadline-dev (6.1-1) ...
But when I tried again,it throws tha same again:
$ script/rails c
/usr/local/rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/irb/completion.rb:9:in `require': no such file to load -- readline (LoadError)
from /usr/local/rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/irb/completion.rb:9:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.0.4/lib/rails/commands/console.rb:3:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.0.4/lib/rails/commands/console.rb:3:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.0.4/lib/rails/commands.rb:20:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.0.4/lib/rails/commands.rb:20:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Then, I try to install readline
using rvm
:
# rvm pkg install readline
Fetching readline-5.2.tar.gz to /usr/local/rvm/archives
Extracting readline-5.2.tar.gz to /usr/local/rvm/src
Applying patch '/usr/local/rvm/patches/readline-5.2/shobj-conf.patch'...
Configuring readline in /usr/local/rvm/src/readline-5.2.
Compiling readline in /usr/local/rvm/src/readline-5.2.
Installing readline to /usr/local/rvm/usr
Fetching readline-6.2.tar.gz to /usr/local/rvm/archives
Extracting readline-6.2.tar.gz to /usr/local/rvm/src
Applying patch '/usr/local/rvm/patches/readline-6.2/patch-shobj-conf.diff'...
Configuring readline in /usr/local/rvm/src/readline-6.2.
Compiling readline in /usr/local/rvm/src/readline-6.2.
Installing readline to /usr/local/rvm/usr
But again the same:
$ script/rails c
/usr/local/rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/irb/completion.rb:9:in `require': no such file to load -- readline (LoadError)
from /usr/local/rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/irb/completion.rb:9:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.0.4/lib/rails/commands/console.rb:3:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.0.4/lib/rails/commands/console.rb:3:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.0.4/lib/rails/commands.rb:20:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.0.4/lib/rails/commands.rb:20:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
What else should I try?
reinstalling ruby is kind of overkill, you can follow the instructions on this blog post.
http://vvv.tobiassjosten.net/ruby-on-rails/fixing-readline-for-the-ruby-on-rails-console
install libreadline5 and libncurses5
then rebuild and reinstall redline
The solution is combining the two steps:
Install libreadline-dev e.g. on an Ubuntu do:
Reinstall Ruby
Then ruby will be compiled using libreadline.
I must check
rvm requirements
and ensure that all packages were installed. Then reintall ruby:And finally it works: