6

I am new to Ruby on Rails, and am using RVM to manage Ruby versions.

My laptop has Ruby1.8.7 installed, but my project is using RVM, Ruby1.9.3 and Rails 3.2.11.

I can't run rails c or rails console without it giving me the following error:

/home/phil/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb/completion.rb:9:in `require': cannot load such file -- readline (LoadError)
from /home/phil/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb/completion.rb:9:in `<top (required)>'
from /home/phil/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.11/lib/rails/commands/console.rb:3:in `require'
from /home/phil/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.11/lib/rails/commands/console.rb:3:in `<top (required)>'
from /home/phil/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.11/lib/rails/commands.rb:38:in `require'
from /home/phil/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.11/lib/rails/commands.rb:38:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
the Tin Man
  • 158,662
  • 42
  • 215
  • 303
polarcare
  • 575
  • 1
  • 6
  • 24

1 Answers1

11

You need to have the readline libraries installed when you compile Ruby.

If you are on CentOS/Redhat/Fedora Linux, install the package using:

sudo yum install readline-devel

Or, on Ubuntu, use:

sudo apt-get install libreadline6 libreadline6-dev

and then recompile Ruby.

j_mcnally
  • 6,928
  • 2
  • 31
  • 46
johnkoht
  • 602
  • 6
  • 11
  • Thanks for responding Stuart and John. I run "rvm use 1.9.3" it displays back "ruby 1.9.3p392 (2013-02-22 revision 39386) [i686-linux]". Everything works fine, it's only when I run "rails c" or "rails console" I get the above error. I ran "sudo apt-get install libreadline6 libreadline6-dev" and installed them, but I still get the error unfortunately. – polarcare Apr 01 '13 at 21:59
  • johnkoht - when you say "then recompile ruby", what exactly do you mean? – polarcare Apr 01 '13 at 22:03
  • Then recompile ruby with "rvm uninstall [RUBYVERSION] followed by rvm install [RUBYVERSION]". That's working now, thanks a million johnkoht, legend! – polarcare Apr 01 '13 at 22:22
  • Glad you got it working (sorry I didn't see your other messages until now). – johnkoht Apr 01 '13 at 23:31