52

I've installed rvm as a way of making sure that my local development version of ruby is the same as my server's for a particular app i work on (ruby 1.8.7). I've done this, and installed ruby 1.8.7 ok. However, when i try to start the rails console i get this error:

Readline was unable to be required, if you need completion or history install readline then reinstall the ruby.
You may follow 'rvm notes' for dependencies and/or read the docs page http://rvm.beginrescueend.com/packages/readline/ . Be sure you 'rvm remove X ; rvm install X' to re-compile your ruby with readline support after obtaining the readline libraries.
Couldn't load Wirble: no such file to load -- wirble

I've read the notes on the page that error refers to (http://rvm.beginrescueend.com/packages/readline/), and followed the instructions, which involve basically installing readline, uninstalling ruby 1.8.7, then installing ruby 1.8.7 again with readline support. (actually that page uses ruby 1.9.2 as an example but i'm assuming it should work with 1.8.7 as well. Perhaps that's not the case).

But, i still get the same error. Has anyone else been through this and figured it out?
Grateful for any advice - max

EDIT - i'm using Ubuntu 9.10 btw in case that's relevant.

EDIT - here's my output for rvm info as asked for below:

$ rvm info

system:

  system:
    uname:       "Linux max-laptop 2.6.31-22-generic #68-Ubuntu SMP Tue Oct 26 16:38:35 UTC 2010 i686 GNU/Linux"
    bash:        "/bin/bash => GNU bash, version 4.0.33(1)-release (i486-pc-linux-gnu)"
    zsh:         " => not installed"

  rvm:
    version:      "rvm 1.1.6 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]"

  homes:
    gem:          "not set"
    ruby:         "not set"

  binaries:
    ruby:         "/usr/bin/ruby"
    irb:          "/usr/bin/irb"
    gem:          "/usr/bin/gem"
    rake:         "/usr/bin/rake"

  environment:
    PATH:         "/home/max/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/var/lib/gems/1.8/bin:/home/max/software/svnmerge:/home/max/.gem/ruby/1.8/bin:/home/max/work/e_learning_resource/trunk/public/assets/dvd_files/bin:/opt/firefox:/home/max/.rvm/bin:/home/max/.rvm/bin"
    GEM_HOME:     ""
    GEM_PATH:     ""
    MY_RUBY_HOME: ""
    IRBRC:        ""
    RUBYOPT:      ""
    gemset:       ""
Max Williams
  • 32,435
  • 31
  • 130
  • 197

7 Answers7

67

I had a similar problem it was with 1.9.2 on Ubuntu 10.04, but the symptoms were identical. In order to get it to work:

rvm pkg install readline

or prior to RVM version 1.6.32, you need the following command

rvm package install readline

Then:

apt-get install ncurses-dev

And then taking from their instructions at http://rvm.beginrescueend.com/packages/readline/

cd $HOME/.rvm/src/ruby-1.9.2-p0/ext/readline
ruby extconf.rb -- --with-readline-dir="$HOME/.rvm/usr"
make install

I had actually done a system rvm install on the server, so I needed to do this:

cd $HOME/.rvm/src/ruby-1.9.2-p0/ext/readline
ruby extconf.rb -- --with-readline-dir="/usr/local/rvm/usr"
make install

After that I was able to have full access to the console.

Geoff Lanotte
  • 7,490
  • 1
  • 38
  • 50
  • Thnx to Geoff Lanotte His solution also works with Ruby 1.9.2-p3 +RVM +Rails 3.0.6 – prikha Apr 09 '11 at 18:47
  • Thanks for your fix. It works for me. The only thing other people might want to check is the path (assuming you are cutting and pasting). My path varied slightly from Geoff. Other than, it worked. Thanks. – 9monkeys May 23 '11 at 18:04
  • 2
    for me I had to use pkg, not package. use rvm pkg install readline – edwardsharp Nov 10 '11 at 00:43
  • Thanks, I updated it to handle the new command name as well as the old command name. – Geoff Lanotte Nov 10 '11 at 14:25
  • Not sure what I am missing. Running ubuntu 11.10, with ruby 1.9.3. and make install doesn't do anything. `~/.rvm/src/ruby-1.9.3-p0/ext/readline$ ruby extconf.rb -- --with-readline-dir="$HOME/.rvm/usr"` `checking for tgetnum() in -lncurses... yes` `checking for readline/readline.h... yes` `checking for readline/history.h... yes` `checking for readline() in -lreadline... no` `checking for readline() in -ledit... no` `checking for editline/readline.h... no` `~/.rvm/src/ruby-1.9.3-p0/ext/readline$ make install` `make: Nothing to be done for 'install'.` – Antony Nov 20 '11 at 01:22
  • Update: Problem solved for me on 11.10. I simply followed another SO question http://stackoverflow.com/questions/8176076/how-to-get-readline-support-in-irb-using-rvm-on-ubuntu-11-10 The missing key here is to install libreadline-dev, and set --with-readline-dir=/usr – Antony Nov 20 '11 at 01:50
  • Ubuntu 11.10 I had a few minor issues so I have posted an answer that addresses all of them – Michael Durrant Jan 21 '12 at 14:39
  • I get this error when install readline "Error running 'autoreconf -is --force', please read /home/hieund/.rvm/log/readline/autoreconf.log ". How to fix? – emeraldhieu Mar 01 '12 at 08:54
10

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!

Sayuj
  • 7,464
  • 13
  • 59
  • 76
  • thanks, running `rvm requirements` and checking the required Linux packages helped in Ubuntu 12.04 too. – David O'Meara Oct 22 '12 at 03:01
  • yes this worked perfectly; in my case, I issued (1) $ sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl ... (2) $ rvm reinstall all --force – aercolino Oct 29 '12 at 21:44
4

I got same problem and solved it. I check http://rvm.beginrescueend.com/packages/readline/ Please check follow 2 things:

  1. sudo aptitude install libreadline5-dev libncurses5-dev use libreadline6-dev, if you have a new version.
  2. ruby extconf.rb -- --with-readline-dir='/home/youruser/.rvm/usr/include/readline' make sure you have the readline lib files under the with-readline-dir you pointed.
Race
  • 923
  • 10
  • 14
0
Readline was unable to be required, if you need completion or history install readline then reinstall the ruby.
You may follow 'rvm notes' for dependencies and/or read the docs page https://rvm.io/packages/readline/ . Be sure you 'rvm remove X ; rvm install X' to re-compile your ruby with readline support after obtaining the readline libraries.

If you follow that link, you will find some instructions on how to fix this problem. What worked for me was the first step, removing all the manually installed packages:

 $ rm -rf $rvm_path/usr

and then

$ rvm requirements
$ rvm reinstall 1.9.3

Hope it works!

finiteautomata
  • 3,753
  • 4
  • 31
  • 41
0

Tried gem install rb-readline

Still did not work. So started irb and did a require readline. The error message helped.

    Readline was unable to be required, if you need completion or history install readline then reinstall the ruby.
You may follow 'rvm notes' for dependencies and/or read the docs page https://rvm.io/packages/readline/ . Be sure you 'rvm remove X ; rvm install X' to re-compile your ruby with readline support after obtaining the readline libraries.
1.9.3p327 :001 > require 'readline'
LoadError: /usr/local/lib/libreadline.so.6: undefined symbol: UP - /home/sudhir/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/x86_64-linux/readline.so
    from /home/sudhir/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /home/sudhir/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from (irb):1
    from /home/sudhir/.rvm/rubies/ruby-1.9.3-p327/bin/irb:16:in `<main>'
1.9.3p327 :002 > ^[[6^[[A^[[A^[[B^C^C

So the problem in my case was all the libreadline* in /usr/local/lib. I had installed readline from source code and that was messing it up.

Followed the instructions here to fix it. http://vkarthickeyan.wordpress.com/2012/02/16/mysql-symbol-lookup-error-usrlocalliblibreadline-so-6-undefined-symbol-up/

Sudhir
  • 736
  • 1
  • 11
  • 23
0

I had this problem with Ruby 2.1.3. Upgrading RVM then reinstalling Ruby worked for me:

rvm get stable
rvm reinstall 2.1.3
oli
  • 1,909
  • 17
  • 14
0

Have you trying this tutorial to use the readline install by brew ?

http://blog.plataformatec.com.br/2010/05/accented-chars-in-irb-with-rvm-and-ruby-1-8-7/

shingara
  • 46,608
  • 11
  • 99
  • 105
  • I'd not heard of Brew but it looks like it's a package manager for OSX. I'm using ubuntu 9.10 - sorry that i didn't mention this in my OP. – Max Williams Dec 23 '10 at 09:40