简体   繁体   English

Rails 5控制台需要macOS Sierra上的readline 6

[英]Rails 5 console needs readline 6 on macOS Sierra

I have only readline 7 installed and I can't find a single way to install version 6 on macOS Sierra. 我只安装了readline 7,我找不到在macOS Sierra上安装第6版的单一方法。 This is the error when trying to run rails c : 这是尝试运行rails c时的错误:

/Users/akashagarwal/.rvm/gems/ruby-2.3.0@global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require': dlopen(/Users/akashagarwal/.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) /Users/akashagarwal/.rvm/gems/ruby-2.3.0@global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in`requirement':dlopen(/Users/akashagarwal/.rvm /rubies/ruby-2.3.0/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle,9 ):未加载库:/usr/local/opt/readline/lib/libreadline.6.dylib(LoadError) )
Referenced from: /Users/akashagarwal/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle Reason: image not found - /Users/akashagarwal/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle 参考自:/Users/akashagarwal/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle原因:图片未找到 - /Users/akashagarwal/.rvm/rubies/红宝石2.3.0 / LIB /红宝石/ 2.3.0 / x86_64的-darwin15 / readline.bundle

I had a similar issue and solved it with: 我有一个类似的问题并解决了它:

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

source: https://github.com/rails/rails/issues/26658 来源: https//github.com/rails/rails/issues/26658

一个对我有用的更好的答案:

rbenv install -f 2.2.3 && RBENV_INSTALL=2.2.3 gem pristine --all

I had the same error and this worked for me. 我有同样的错误,这对我有用。
Add gem 'rb-readline' in your Gemfile and bundle install 在Gemfile中添加gem'rb gem 'rb-readline'bundle install

And just type bundle exec rails c 然后输入bundle exec rails c

Jim Meyer wrote a good answer, but an even better blog post. 吉姆迈耶写了一个很好的答案,但更好的博客文章。

Specifically this is what should be done given that you use rbenv and maybe also homebrew to install readline: (cut from Jim's blog post for posterity) 具体来说,这是应该做什么,因为你使用rbenv,也许也是自制软件来安装readline :(从Jim的博客文章中删除后代)

> xcode-select --install
[... popup dialog launches and you do the install dance ...]
> brew update && brew upgrade
[... many package defs update and upgrade ... ]
> for i in `rbenv versions --bare|xargs`; do rbenv install -f $i && RBENV_VERSION=$i gem pristine --all; done
[... much building of ruby and gem native extensions for each installed ruby version ...]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM