Parker Harris Parker Harris - 1 year ago 307
Ruby Question

Unable to Execute Rails console command Ruby

/Users/parkerharris/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/irb/completion.rb:10:in `require': dlopen(/Users/parkerharris/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError)
Referenced from: /Users/parkerharris/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle
Reason: image not found - /Users/parkerharris/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle
from /Users/parkerharris/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/irb/completion.rb:10:in `<top (required)>'
from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties- `require'
from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties- `<top (required)>'
from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties- `require'
from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties- `require_command!'
from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties- `console'
from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties- `run_command!'
from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties- `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'

This is my error screen after trying to execute the command. I've tried to uninstall and reinstall readline and that did not help. I am just learning rails and do not 100% know what I am doing (just following a guide) so this type of error is past my understanding. Thanks!

Answer Source

Might not be related, but I had the same thing happen to me today.

I had a fully-functioning Ruby 2.3.1 working fine this morning. In my case, Ruby was compiled and installed by ruby-build and managed by rbenv.

At one point today I updated Homebrew with

brew cleanup --prune=30
brew update
brew upgrade

One of the formulae upgraded was readline 7.0:

$ brew info readline
/usr/local/Cellar/readline/7.0 (45 files, 2M)
  Poured from bottle on 2016-10-05 at 08:09:22

Shortly afterwords I found that my readline support for Ruby had become completely broken. I saw errors just like yours:

/Users/mbrictson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/pry-0.10.4/lib/pry/config/default.rb:151:in `require': dlopen(/Users/mbrictson/.rbenv/versions/2.3.1/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError)
  Referenced from: /Users/mbrictson/.rbenv/versions/2.3.1/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle
  Reason: image not found - /Users/mbrictson/.rbenv/versions/2.3.1/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle
  from /Users/mbrictson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/pry-0.10.4/lib/pry/config/default.rb:151:in `lazy_readline'

The solution was to completely delete my Ruby installation and recompile it:

rm -rf ~/.rbenv/versions/2.3.1
rbenv install 2.3.1

I know you are using rvm and not rbenv, but perhaps the solution in your case is similar: delete your Ruby installation and re-install it using rvm.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download