Help us understand the problem. What is going on with this article?

Sorry, you can't use Pry without Readline or a compatible library.でpryが起動しなくなった時の対処法

More than 1 year has passed since last update.

対処法

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

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

経緯

何かをインストールしてからpryを起動しようとして、以下のようなエラーが出てしまいました。

Sorry, you can't use Pry without Readline or a compatible library.
Possible solutions:
 * Rebuild Ruby with Readline support using `--with-readline`
 * Use the rb-readline gem, which is a pure-Ruby port of Readline
 * Use the pry-coolline gem, a pure-ruby alternative to Readline
/Users/v97ug/.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': dlopen(/Users/v97ug/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/x86_64-darwin16/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib (LoadError)
  Referenced from: /Users/v97ug/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/x86_64-darwin16/readline.bundle
  Reason: image not found - /Users/v97ug/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/x86_64-darwin16/readline.bundle
    from /Users/v97ug/.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/v97ug/.rvm/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/pry-0.11.3/lib/pry/config/default.rb:139:in `lazy_readline'
    from /Users/v97ug/.rvm/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/pry-0.11.3/lib/pry/config/default.rb:7:in `block in <class:Default>'
    from /Users/v97ug/.rvm/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/pry-0.11.3/lib/pry/config/memoization.rb:25:in `instance_eval'
    from /Users/v97ug/.rvm/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/pry-0.11.3/lib/pry/config/memoization.rb:25:in `block (2 levels) in def_memoized'
    from /Users/v97ug/.rvm/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/pry-0.11.3/lib/pry/config/behavior.rb:183:in `public_send'
    from /Users/v97ug/.rvm/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/pry-0.11.3/lib/pry/config/behavior.rb:183:in `method_missing'
    from /Users/v97ug/.rvm/gems/ruby-2.3.0@global/gems/pry-0.11.3/lib/pry/history.rb:19:in `restore_default_behavior'
    from /Users/v97ug/.rvm/gems/ruby-2.3.0@global/gems/pry-0.11.3/lib/pry/history.rb:14:in `initialize'
    from /Users/v97ug/.rvm/gems/ruby-2.3.0@global/gems/pry-0.11.3/lib/pry/pry_class.rb:33:in `new'
    from /Users/v97ug/.rvm/gems/ruby-2.3.0@global/gems/pry-0.11.3/lib/pry/pry_class.rb:33:in `history'
    from /Users/v97ug/.rvm/gems/ruby-2.3.0@global/gems/pry-0.11.3/lib/pry/pry_class.rb:245:in `load_history'
    from /Users/v97ug/.rvm/gems/ruby-2.3.0@global/gems/pry-0.11.3/lib/pry/pry_class.rb:149:in `final_session_setup'
    from /Users/v97ug/.rvm/gems/ruby-2.3.0@global/gems/pry-0.11.3/lib/pry/cli.rb:84:in `parse_options'
    from /Users/v97ug/.rvm/gems/ruby-2.3.0@global/gems/pry-0.11.3/bin/pry:11:in `<top (required)>'
    from /Users/v97ug/.rvm/gems/ruby-2.3.0/bin/pry:23:in `load'
    from /Users/v97ug/.rvm/gems/ruby-2.3.0/bin/pry:23:in `<main>'
    from /Users/v97ug/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
    from /Users/v97ug/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'

それでググったら以下の記事を見つけたのでその通りにやったらできました。(パスは少し変えています)

Rails consoleでエラーが出た場合

$ ln -s /usr/local/opt/readline/lib/libreadline.8.0.dylib /usr/local/opt/readline/lib/libreadline.7.dylib
$ pry
[1] pry(main)>
v97ug
型に生き、型を守りて、型を往く
https://anison-pianist.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
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  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
ユーザーは見つかりませんでした