ノンカフェインであなたにやさしい

Ruby,Rails,HTML,CSS,Reactなど

libreadlineのエラーでrails consoleが動かない問題

解決法

とりあえず解決した方法。
無いぞと言われてるパスにシンボリックリンクを張る

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

出たエラー

/Users/user/.rbenv/versions/2.4.0/lib/ruby/2.4.0/irb/completion.rb:10:in `require': dlopen(/Users/user/.rbenv/versions/2.4.0/lib/ruby/2.4.0/x86_64-darwin16/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError)
  Referenced from: /Users/user/.rbenv/versions/2.4.0/lib/ruby/2.4.0/x86_64-darwin16/readline.bundle
  Reason: image not found - /Users/user/.rbenv/versions/2.4.0/lib/ruby/2.4.0/x86_64-darwin16/readline.bundle
  from /Users/akinov/.rbenv/versions/2.4.0/lib/ruby/2.4.0/irb/completion.rb:10:in `<top (required)>'
   from /Users/akinov/work/rails_project/test/example/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands/console/console_command.rb:2:in `require'
  from /Users/akinov/work/rails_project/test/example/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands/console/console_command.rb:2:in `<top (required)>'
    from /Users/akinov/work/rails_project/test/example/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command/behavior.rb:82:in `require'
  from /Users/akinov/work/rails_project/test/example/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command/behavior.rb:82:in `block (2 levels) in lookup'
   from /Users/akinov/work/rails_project/test/example/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command/behavior.rb:78:in `each'
  from /Users/akinov/work/rails_project/test/example/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command/behavior.rb:78:in `block in lookup'
    from /Users/akinov/work/rails_project/test/example/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command/behavior.rb:77:in `each'
  from /Users/akinov/work/rails_project/test/example/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command/behavior.rb:77:in `lookup'
   from /Users/akinov/work/rails_project/test/example/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command.rb:68:in `find_by_namespace'
  from /Users/akinov/work/rails_project/test/example/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command.rb:42:in `invoke'
    from /Users/akinov/work/rails_project/test/example/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
  from bin/rails:4:in `require'
   from bin/rails:4:in `<main>'

その他、試した方法

StackOverflowでbrewで再インストールしろよって回答があったがこちらはダメだった

stackoverflow.com

brew rm -f readline
brew install readline
brew link readline --force