rigelstpierre
rigelstpierre

Reputation: 544

Rails Console Not Loading

When trying to start rails console I keep getting the following error

Users/rigelstpierre/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/completion.rb:9:in `require': dlopen(/Users/rigelstpierre/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin11.4.0/readline.bundle, 9): Library not loaded: /Users/rigelstpierre/.rvm/usr/lib/libreadline.6.2.dylib (LoadError)
  Referenced from: /Users/rigelstpierre/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin11.4.0/readline.bundle
  Reason: image not found - /Users/rigelstpierre/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin11.4.0/readline.bundle
    from /Users/rigelstpierre/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/completion.rb:9:in `<top (required)>'
    from /Users/rigelstpierre/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.2/lib/rails/commands/console.rb:3:in `require'
    from /Users/rigelstpierre/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.2/lib/rails/commands/console.rb:3:in `<top (required)>'
    from /Users/rigelstpierre/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.2/lib/rails/commands.rb:38:in `require'
    from /Users/rigelstpierre/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.2/lib/rails/commands.rb:38:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Any thoughts? Rails 3.2.2 application

Upvotes: 18

Views: 8768

Answers (8)

Ceasar
Ceasar

Reputation: 23083

In my case, the version numbers of readline were different, and I was missing libreadline.7.dylib. Linking and unlinking using Homebrew didn't help. The following did though:

~$ cd /usr/local/opt/readline/lib
/usr/local/opt/readline/lib$ ls -l
total 1448
-r--r--r--  1 ceasar  staff   40396 Mar 22 11:35 libhistory.8.0.dylib
lrwxr-xr-x  1 ceasar  staff      20 Dec 19 13:07 libhistory.8.dylib -> libhistory.8.0.dylib
-r--r--r--  1 ceasar  staff   45848 Dec 19 13:07 libhistory.a
lrwxr-xr-x  1 ceasar  staff      20 Dec 19 13:07 libhistory.dylib -> libhistory.8.0.dylib
-rw-r--r--  1 ceasar  staff  239260 Mar 22 11:35 libreadline.8.0.dylib
lrwxr-xr-x  1 ceasar  staff      21 Dec 19 13:07 libreadline.8.dylib -> libreadline.8.0.dylib
-r--r--r--  1 ceasar  staff  406384 Dec 19 13:07 libreadline.a
lrwxr-xr-x  1 ceasar  staff      21 Dec 19 13:07 libreadline.dylib -> libreadline.8.0.dylib
drwxr-xr-x  3 ceasar  staff      96 Mar 22 11:35 pkgconfig
/usr/local/opt/readline/lib$ ln -s libreadline.dylib libreadline.7.dylib

Upvotes: 1

Joe B.
Joe B.

Reputation: 1164

Looking elsewhere, none of the re-linking options worked. It was suggested to redo the rvm installation (which seems onerous). However, simply adding readline into the Gemfile works for me:

gem 'rb-readline'

Upvotes: 15

Lukasz Muzyka
Lukasz Muzyka

Reputation: 2783

I had this couple of days ago. You can try to reinstall/recompile your ruby. In my case problem appeared when updating from El Capitan to Sierra

so depending on your manager:

RVM

rvm reinstall 2.3.0

Rbenv

rbenv uninstall 2.3.0
rbenv install 2.3.0

asdf

asdf uninstall ruby 2.3.0
asdf install ruby 2.3.0

Upvotes: 15

Mutafaf
Mutafaf

Reputation: 126

On macOS Sierra I was facing the same issue with homebrew and libreadline, I tried to do brew link readline, brew link readline --force and brew update but all in vain, then I found another solution that solved my issue.

There was a linking issue libreadline required by homebrew was unlinked and not able to link by brew commands

Creating a symbolic link solved my issue.

ln -s /usr/local/opt/readline/lib/libreadline.7.0.dylib /usr/local/opt/readline/lib/libreadline.6.dylib

Try creating symbolic link. Hope this solves your problem.

Upvotes: 1

张艳军
张艳军

Reputation: 261

For me on macOS sierra, brew link readline or brew link readline --force does not work and I ran brew update recently. But rails console does work after I do as below:

rvm reinstall 2.3.1

Upvotes: 5

cnikolaou
cnikolaou

Reputation: 3992

After reinstalling readline, I could still not able to load rails console.

However, reinstalling ruby did it for me.

rvm reinstall 1.9.3

PS: I'm on OSX El Capitan

Upvotes: 3

Ron Crosler
Ron Crosler

Reputation: 276

It could be that there are multiple versions of readline installed.

Try the following:

brew link readline --force

Upvotes: 25

Iran R
Iran R

Reputation: 131

It is because multiple versions of readline is installed (Could be because you ran brew update recently). What Ron said is right. You can fix it by running brew link readline or brew link readline --force.

If it still doesn't work, find which readline and move to readline folder then delete the version that you don't need (Or the ones that installed by running brew update). Then run brew link readline again.

Upvotes: 12

Related Questions