Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib

后端 未结 11 1609
时光取名叫无心
时光取名叫无心 2021-01-30 01:57

When I try running rails console I get this error:

/Users/TuzsNewMacBook/.rvm/gems/ruby-2.3.7/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_         


        
相关标签:
11条回答
  • 2021-01-30 02:42

    Most often in Ruby-applications, this is caused by gems that have extensions (the gems saying "Building native extensions.."), that are built using a specific version of, in this case, readline.

    Basically, there are two solutions:

    Either, you can symlink version 8 of the gem, to the version missing. This will work in many cases, but if backwards compatibility is broken, it will not.

    Or, if the gem actually supports version 8, you can reinstall that specific gem, or "pristine" it by running gem pristine --all.

    EDIT: In scope of your "what I've tried", reinstalling PostgreSQL, is also one of the binaries, built using a specific version, that may also require a rebuild, to work with a system library, such as readline.

    0 讨论(0)
  • 2021-01-30 02:44

    the error seems to be thrown when searching for /usr/local/opt/readline/lib/libreadline.7.dylib.

    Have you tried to symlink that?

    So something like:

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

    Just tried that on macOS Mojave, ruby 2.5.3p105 and Rails 5.2.2 and worked.

    0 讨论(0)
  • 2021-01-30 02:46

    A very simple solution that doesn't involve rebuilding your RVM gemset OR sym-linking libraries.

    Add to your Gemfile:

    gem 'rb-readline'
    

    If you are doing bundler groups

    group :development do
      gem 'rb-readline'
    end
    

    Then run

    > bundle
    

    Let me know if that doesn't work.

    0 讨论(0)
  • 2021-01-30 02:47

    can you try

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

    you are on the right track but it seems like rails is looking for libreadline.7.dylib and libreadline.7.dylib is not there in the folder.

    0 讨论(0)
  • 2021-01-30 02:48

    Reinstalling my Ruby version seems to have fixed it:

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