install ruby 1.9.3 using rvm on ubuntu

CLod picture CLod · Jan 19, 2012 · Viewed 16.3k times · Source

Possible Duplicate:
Ruby 1.9.2 and Rails 3 cannot open rails console

I have already installed rvm and ruby 1.9.2, both working properly. Using rvm version 1.10.2. I previously installed the rvm packages readline/zlib, but now I'm having big troubles with readline now. I'm trying to install ruby 1.9.3 in rvm, but I always end up having readline not found.

I tried to follow different solutions:

 rvm remove 1.9.3
 rvm pkg install readline
 rvm install 1.9.3 --with-readline-dir=$rvm_path/usr/ \
     --with-zlib-dir=$rvm_path/usr/

 rvm use 1.9.3
 rvmsudo gem install bundler
 bundle install (all gems installed fine)
 rails c / rails s 
 .rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/irb/completion.rb:9:in `require': \
     cannot load such file -- readline (LoadError)

I have libreadline-dev (version 6, the current one) installed (everything needed by those packages pretty much)

I also tried the following:

.rvm/src/ruby-1.9.3-p0/ext/readline]$ ruby extconf.rb 
 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]$ ruby extconf.rb \
    --with-readline-dir=/home/claudiocontin/.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]$ ruby extconf.rb \
    --with-readline-lib=/home/claudiocontin/.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

Makefile is not generated of course ...

 apt-get install libreadline-dev
 Reading package lists... Done
 Building dependency tree       
 Reading state information... Done
 libreadline-dev is already the newest version.

Ideas?

Answer

Philippe Creux picture Philippe Creux · Jan 23, 2012

I tried to do rvm pkg readline, install ubuntu pkgs etc without any success. What worked for me:

gem install rb-readline

And add the following line to your Gemfile:

gem 'rb-readline'