Jay
Jay

Reputation: 6244

no such file to load -- readline

I am getting the following error:

$script/console
Loading development environment (Rails 2.2.2)
/opt/ruby-enterprise-1.8.6-20080709/lib/ruby/1.8/irb/completion.rb:10:in `require': no such file to load -- readline (LoadError)

Where can i get the file and what directory should it go in?

Thanks!

Upvotes: 39

Views: 19362

Answers (6)

boulder_ruby
boulder_ruby

Reputation: 39695

Add the following line to your Gemfile and run bundle update

gem 'rb-readline'

credits to similar question/answer at install ruby 1.9.3 using rvm on ubuntu

Upvotes: 10

Darth Egregious
Darth Egregious

Reputation: 20086

Maybe this is a bullshit answer, but I ran into this problem today after upgrading postgres from 9.5.3 to 9.6, along with which homebrew upgraded readline from 6.something to 7. I ended up rolling back my postgres to 9.5.3 and that resolved the issue.

Upvotes: -1

Rubyrider
Rubyrider

Reputation: 3587

This easiest way to get relief from this problem, just add to your Gemfile:

gem 'rb-readline'

And then run bundle install

Upvotes: 6

jatin
jatin

Reputation: 1439

You need to install the ncurses and readline libraries.

On Ubunutu you could do

sudo apt-get install libreadline5-dev libncurses5-dev

and then you will have to recompile readline which comes with your ruby source

cd <ruby-src-dir>/ext/readline
ruby extconf.rb
make
sudo make install

If you are using RVM you could simply do

rvm package install readline

EDIT:

On newer RVM versions, this last command is

rvm pkg install readline

Upvotes: 31

Sayuj
Sayuj

Reputation: 7612

Run the command

rvm requirements

It shows the requirements and dependencies. Install those and reinstall the ruby on rvm

rvm remove 1.9.2
rvm install 1.9.2

It works!

EDIT

If you can't find the requirements option update your rvm.

rvm update --head  # older rvm

or use rvm upgrade

Upvotes: 2

St&#233;phan Kochen
St&#233;phan Kochen

Reputation: 19933

The readline module is normally part of the Ruby package itself.

Did you manually build your Ruby install? If so, you want to make sure libreadline and its headers are installed, and build again.

On Debian/Ubuntu:

apt-get install libreadline-dev

Or on RHEL/CentOS, try

yum install readline-devel

Update:

You are using a very old release of Ubuntu. If you want to keep using it, open /etc/apt/sources.list in a text editor, and change all occurrences of archive.ubuntu.com to old-releases.ubuntu.com. Then, run apt-get update and try the above again.

I urge you to consider updating your installation, though. Ubuntu 7.10 hasn't seen security updates in quite a while, and using it in production is not recommended. Even if it's not a production machine, there's a good chance you'll run into further problems because of old versions of certain libraries/dependencies.

Upvotes: 45

Related Questions