0

I've reinstalled the Ruby version a bunch of times, but I couldn't find why, when I go to the terminal and type rails c, it throws this error:

.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/irb/completion.rb:9:in `require': cannot load such file -- readline (LoadError)
from /Users/cleytonmessias/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/irb/completion.rb:9:in `<top (required)>'
from /Users/cleytonmessias/.rvm/gems/ruby-2.0.0-p247@trustvox/gems/railties-4.0.3/lib/rails/commands/console.rb:3:in `require'
from /Users/cleytonmessias/.rvm/gems/ruby-2.0.0-p247@trustvox/gems/railties-4.0.3/lib/rails/commands/console.rb:3:in `<top (required)>'
from /Users/cleytonmessias/.rvm/gems/ruby-2.0.0-p247@trustvox/gems/railties-4.0.3/lib/rails/commands.rb:51:in `require'
from /Users/cleytonmessias/.rvm/gems/ruby-2.0.0-p247@trustvox/gems/railties-4.0.3/lib/rails/commands.rb:51:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'

I'm on Mac OSX Mavericks, Ruby-2.0.0-p247 and Rails 4.

Rajesh Omanakuttan
  • 6,788
  • 7
  • 47
  • 85
Cleyton
  • 2,338
  • 6
  • 23
  • 39
  • Have you run `bundle`? Are you in a rails application's directory? It seems like you don't have libreadline or the readline gem. [Several](http://stackoverflow.com/questions/7270169/how-to-install-readline-for-rails-console?rq=1) [questions](http://stackoverflow.com/questions/4385549/no-such-file-to-load-readline) identical. – Nick Veys Apr 10 '14 at 18:32
  • Yes...I'm on my application directory. Does libreadline only to Ubuntu? Im on Mavericks – Cleyton Apr 10 '14 at 18:42
  • This one was answered here already: http://stackoverflow.com/a/6375913/1870446 – konnigun Apr 10 '14 at 19:54
  • @Chelios This only works for Ubuntu. I'm on Mavericks – Cleyton Apr 10 '14 at 19:57
  • 2
    Please do `rvm uninstall ruby-2.0.0-p247`. Then run `rvm requirements`, if there are anything pending to be installed, install it. After that do a fresh `rvm install ruby-2.0.0-p247`. – Rajesh Omanakuttan Apr 11 '14 at 04:50
  • You didn't compile ruby with readline support. – sevenseacat Apr 11 '14 at 06:32

1 Answers1

0

I finally found a reference that helped me.

Using this link:

  • brew install readline
  • brew link readline
  • I went to file ~/.rvm/user/db and add the following line: ruby_configure_flags=--with-readline-dir=/usr/local/opt/readline
  • rvm reinstall 2.0.0-p247 --with-openssl-dir=/usr/local

Now when I type rails c it's working again :)

Cleyton
  • 2,338
  • 6
  • 23
  • 39