Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

rails consoleでreadline(LoadError)が出た場合の対処

More than 5 years have passed since last update.

railsプロジェクトを作って、 rails console をしたら以下のようなエラーが出た。

$ bundle exec rails console
~/.rbenv/versions/2.1.3/lib/ruby/2.1.0/irb/completion.rb:9:in `require': dlopen(~/.rbenv/versions/2.1.3/lib/ruby/2.1.0/x86_64-darwin13.0/readline.bundle, 9): Library not loaded: @@HOMEBREW_PREFIX@@/opt/readline/lib/libreadline.6.dylib (LoadError)
  Referenced from: ~/.rbenv/versions/2.1.3/lib/ruby/2.1.0/x86_64-darwin13.0/readline.bundle
  Reason: image not found - ~/.rbenv/versions/2.1.3/lib/ruby/2.1.0/x86_64-darwin13.0/readline.bundle
        from ~/.rbenv/versions/2.1.3/lib/ruby/2.1.0/irb/completion.rb:9:in `<top (required)>'

単純にインストールし忘れたと思ったけど、違った。

$ brew install readline
Warning: readline-6.3.8 already installed

どうやら、rb-readlineが必要らしいので、Gemfileにgem 'rb-readline' を追加してインストール

$ bundle install --path vendor/bundle

もう一度実行。

$ bundle exec rails console
Loading development environment (Rails 4.1.6)
irb(main):001:0>

成功!

ko2ic
最近はflutterです。
uzabase
企業活動の意思決定を支える情報インフラの提供
https://www.uzabase.com/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away