Why does the Rails console say "it is not possible to load such a file - readline"?

I'm new to Ruby on Rails and use RVM to control Ruby versions.

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

I cannot run rails c or rails console without 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>' 
+6
source share
1 answer

You need to have the readline libraries installed when compiling Ruby.

If you are running 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.

+11
source

All Articles