Note: you’ll need to install pry and pry-debugger.

Note also: you may come across pry-nav which is an older project and, if you’re using MRI 1.9.2+, they recommend you use pry-debugger.


require ‘pry’   # note that Rails auto loads stuff but if you’re just using plain old Ruby then you’ll need to manually load this…

require ‘pry-debugger’

2. then start a REPL session with


So, what is binding? Basically objects of class Binding encapsulate the execution context at some particular place in the code and retain this context for future use but see the docs:

3. and step through with ‘step’


1. Local variables are available to a Pry session (locals are not available to an irb session when using `irb -r`)

2. When you end a Pry session it returns to the running program; very useful for debugging

See also:


Leave a Reply

Your email address will not be published. Required fields are marked *