1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

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

Posted at

対処法

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

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)>
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?