Skip to content


pry dislikes ruby compiled without readline (much so) #556

danielb2 opened this Issue · 9 comments

5 participants


If pry is run without readline compiled in ruby, the error below is displayed.

Pry should probably automatically disable readline if it's not available. See related ticket at: #473

$ pry
/home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry- warning: already initialized constant DEFAULT_HOOKS
/home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry- warning: already initialized constant DEFAULT_PRINT
/home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry- warning: already initialized constant SIMPLE_PRINT
/home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry- warning: already initialized constant CLIPPED_PRINT
/home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry- warning: already initialized constant DEFAULT_EXCEPTION_HANDLER
/home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry- warning: already initialized constant DEFAULT_EXCEPTION_WHITELIST
/home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry- warning: already initialized constant DEFAULT_PROMPT
/home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry- warning: already initialized constant SIMPLE_PROMPT
/home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry- warning: already initialized constant SHELL_PROMPT
/home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry- warning: already initialized constant NAV_PROMPT
/home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry- warning: already initialized constant DEFAULT_CONTROL_D_HANDLER
/home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry- warning: already initialized constant DEFAULT_SYSTEM
/home/vagrant/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- readline (LoadError)
        from /home/vagrant/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry- `<top (required)>'
        from /home/vagrant/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /home/vagrant/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry- `rescue in <top (required)>'
        from /home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry- `<top (required)>'
        from /home/vagrant/.rvm/gems/ruby-1.9.3-p194/bin/pry:23:in `load'
        from /home/vagrant/.rvm/gems/ruby-1.9.3-p194/bin/pry:23:in `<main>'
pry member

Can you tell me how IRB behaves in absense of readline? maybe a gist or screenshot (im curious about whether they have a prompt and whether history works)


You get the big failure I pasted above.

pry member

@danielb2 so IRB fails too, as well as pry?


oh I'm sorry. I completely glossed over the fact that you wrote IRB. Hm, I don't know. That install now has readline.
let me try to see what I can find.

pry member

Ruby 1.9.3 and Pry here.

My arrow keys stopped working properly in pry and irb (navigation through history). However, they worked flawlessly before. I just dormantly updated my system (Arch Linux) so I don't really know, what it could be. Shell history works as always: perfect. Here is the video of the problem (I hope it's understandable):

I also tested out on Xubuntu and got exactly the same result as @danielb2


IRB without readline works fine. You can use irb with or without readline.

Difference is that you won't get some cool features in IRB without readline though, like using arrow key to scrollback (which can be very useful if you want to easily edit a long command you just wrote which had a typo).

I think Debian may sometimes have an IRB without readline.

It's interesting that danielb2 uses RVM without a readline available, but yeah, pry should make readline optional :)

pry member

False alarm, guys. I merely added this to my .inputrc:

set editing-mode vi

Thanks to @ConradIrwin, who helped me to understand the problem.

$ irb
Readline was unable to be required, if you need completion or history install readline then reinstall the ruby.
You may follow 'rvm notes' for dependencies and/or read the docs page . Be sure you 'rvm remove X ; rvm install X' to re-compile your ruby with readline support after obtaining the readline libraries.
pry member

I've left #473 open in case we want to actually support non-readline rubies. I don't think we do in the near term, but there may be good reasons (if some popular hosting provider compiles ruby with no readline support for example).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.