Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError)

前端 未结 8 746
囚心锁ツ
囚心锁ツ 2021-01-31 01:03

I try to run my rails c but for some reason, I get this error:

https://gist.github.com/anonymous/166713e8cde860fb188a8dffb98a1563

ᐅ rails c
         


        
相关标签:
8条回答
  • 2021-01-31 01:32

    In my case readline was installed but not linked after a MacOS migration. This command fixed it:

    brew link --force readline
    
    0 讨论(0)
  • 2021-01-31 01:32

    simply reinstalling ruby 2.3.0 fixed my problem on macos I use rbenv rbenv install 2.3.0 did the trick

    0 讨论(0)
  • 2021-01-31 01:34

    I had the same underlying issue, which also occurred after a Mac OSX update. My problem manifested using psql:

    >> psql --help
    
    dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib
      Referenced from: /usr/local/bin/psql
      Reason: image not found
    

    OK, so this is telling me that it's expecting libreadline.7.dylib in /usr/local/opt/readline/lib. When I browse that directory, I can see I have libreadline.8.0.dylib:

    >> ls -l /usr/local/opt/readline/lib
    
    total 1448
     libhistory.8.0.dylib
     libhistory.8.dylib -> libhistory.8.0.dylib
     libhistory.a
     libhistory.dylib -> libhistory.8.0.dylib
     libreadline.8.0.dylib
     libreadline.8.dylib -> libreadline.8.0.dylib
     libreadline.a
     libreadline.dylib -> libreadline.8.0.dylib
    
    

    I made the assumption that emulating libreadline.7.dylib by using symlinking to libreadline.8.0.dylib could resolve my problem:

    >> ln -s /usr/local/opt/readline/lib/libreadline.8.0.dylib /usr/local/opt/readline/lib/libreadline.7.dylib
    

    Which makes my call to psql work again, but doesn't address how the problem started in the first place.

    0 讨论(0)
  • 2021-01-31 01:36

    I installed the ruby of same version over again. Then the error message is gone now. I use macbook and homebrew.

    $ rbenv install 2.3.8
    rbenv: /Users/klee/.rbenv/versions/2.3.8 already exists
    continue with installation? (y/N) y
    ruby-build: use openssl from homebrew
    Downloading ruby-2.3.8.tar.bz2...
    -> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.8.tar.bz2
    Installing ruby-2.3.8...
    ruby-build: use readline from homebrew
    Installed ruby-2.3.8 to /Users/klee/.rbenv/versions/2.3.8
    
    0 讨论(0)
  • 2021-01-31 01:38

    Add this gem to your Gemfile and run bundle install:

    gem 'rb-readline'
    
    0 讨论(0)
  • 2021-01-31 01:51

    This command fix my problem:

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

    OR

    ln -s /usr/local/opt/readline/lib/libreadline.8.0.dylib /usr/local/opt/readline/lib/libreadline.7.dylib
    

    I wrote a Gist about this problem here. There are many people sharing their solutions there too.

    0 讨论(0)
提交回复
热议问题