Pry: Sorry, you can't use Pry without Readline or a compatible library

Created on 2 Nov 2016  路  4Comments  路  Source: pry/pry

Using pry (gem version 0.10.4), with ruby-2.3.1 (installed with RVM), on macbook with macOS Sierra (version 10.12.1), I get the following error when placing a binding.pry in a view in a Rails project (Rails 5.0.0.1).

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

screen shot 2016-11-02 at 16 19 16

The fix for me

As suggested in the error message and this stack overflow post (http://stackoverflow.com/questions/22923526/ruby-gems-suddenly-stopped-working-on-ubuntu-12-04), I fixed the problem by installing the gem 'rb-readline'

group :development, :test do
  gem 'pry'
  gem 'rb-readline'
end

Suggestion

Could you perhaps add rb-readline as a pry gem dependency?

Most helpful comment

Thanks for the detailed report! I think a lot of people have been running into this problem since Readline 7 came out. See this comment for a little more background, but the short answer is that you should use RVM to recompile your copy of Ruby, because you've upgraded your libreadline and your Ruby is compiled against the older version.

I don't think we'd ever want Pry to depend on rb-readline, if only because it completely replaces the global Readline constant, which is likely to cause conflicts with other code that depends on Readline.

All 4 comments

Thanks for the detailed report! I think a lot of people have been running into this problem since Readline 7 came out. See this comment for a little more background, but the short answer is that you should use RVM to recompile your copy of Ruby, because you've upgraded your libreadline and your Ruby is compiled against the older version.

I don't think we'd ever want Pry to depend on rb-readline, if only because it completely replaces the global Readline constant, which is likely to cause conflicts with other code that depends on Readline.

Thanks for the detailed report! I think a lot of people have been running into this problem since Readline 7 came out. See this comment for a little more background, but the short answer is that you should use RVM to recompile your copy of Ruby, because you've upgraded your libreadline and your Ruby is compiled against the older version.

I don't think we'd ever want Pry to depend on rb-readline, if only because it completely replaces the global Readline constant, which is likely to cause conflicts with other code that depends on Readline.

For some reason I got this issue as well in 2019,
not sure what triggers it, rarely updated any packages.

I'm using RVM, updating rvm and reinstalling the specific ruby version solved it for me
rvm get master # get latest rvm
rvm reinstall ruby-x.x.x # replace x.x.x with your ruby version

Did you compile your Ruby with Readline support?

Readline 8 came out 馃槄

Was this page helpful?
0 / 5 - 0 ratings