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

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
33
Help us understand the problem. What are the problem?

More than 3 years have passed since last update.

@kanpou0108

pryでReadlineがないエラーの解決方法

環境

mac OS X El Capitan バージョン10.11.6
rbenv
ruby 2.3.1

エラー内容

pryを実行しようとしたら突然以下の様なエラーが出た。

$ pry
Sorry, you can't use byebug without Readline. To solve this, you need to
rebuild Ruby with Readline support. If using Ubuntu, try `sudo apt-get install libreadline-dev` and then reinstall your Ruby.
.....
/Users/XXXXX/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': dlopen(/Users/XXXXX/.rbenv/versions/2.3.1/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError)
  Referenced from: /Users/XXXXX/.rbenv/versions/2.3.1/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle
  Reason: image not found - /Users/XXXXX/.rbenv/versions/2.3.1/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle

解決方法

以下のコマンド実行で解決した。

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

原因(と思われるもの)

brew udpate で readlineが何かアップデートされたのが原因かもしれない。
/usr/local/opt/readline/lib/libreadline.6.dylibが削除されていた。
上記コマンドでsymlinkを作成したことによって解決したと思われる。

$ ll /usr/local/opt/readline/lib/
total 1376
drwxr-xr-x 11 XXXXX admin    374 12  8 00:15 .
drwxr-xr-x 12 XXXXX admin    408 12  5 17:26 ..
-r--r--r--  1 XXXXX admin  84728 12  5 17:26 libhistory.7.0.dylib
lrwxr-xr-x  1 XXXXX admin     20  9  8 06:16 libhistory.7.dylib -> libhistory.7.0.dylib
-r--r--r--  1 XXXXX admin  84504  9  8 06:16 libhistory.a
lrwxr-xr-x  1 XXXXX admin     20  9  8 06:16 libhistory.dylib -> libhistory.7.0.dylib
lrwxr-xr-x  1 XXXXX admin     45 12  8 00:15 libreadline.6.dylib -> /usr/local/opt/readline/lib/libreadline.dylib
-r--r--r--  1 XXXXX admin 459608 12  5 17:26 libreadline.7.0.dylib
lrwxr-xr-x  1 XXXXX admin     21  9  8 06:16 libreadline.7.dylib -> libreadline.7.0.dylib
-r--r--r--  1 XXXXX admin 751552  9  8 06:16 libreadline.a
lrwxr-xr-x  1 XXXXX admin     21  9  8 06:16 libreadline.dylib -> libreadline.7.0.dylib

cf)"Sorry, you can't use byebug without Readline" · Issue #289 · deivid-rodriguez/byebug

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
33
Help us understand the problem. What are the problem?