pry/pry: a runtime Ruby console for inspecting live program state
A runtime developer console and IRB alternative with powerful introspection capabilities.
At a glance
- What is it?
- Pry is an IRB alternative that opens a REPL inside a running Ruby process, with commands for navigating object scope, browsing source and docs, and shelling out. This review covers what it does, how to install it, and where it stops being the right tool.
- Who is it for?
- Adopt Pry when you need a REPL inside a live Ruby process and want object navigation, source browsing and shell access from one prompt; skip it if your team already standardises on a debugger such as debug.gem or Pry-byebug and does not need the introspection layer.
- Can I use it commercially?
- Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
- Is it still maintained?
- Yes. The repository last received commits 9 days ago.
- What is it written in?
- Mainly Ruby, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 27, 2026, and from our analysis. They are not legal advice.
Editorial analysis
What Pry replaces and who ends up using it
The README describes Pry as "a runtime developer console and IRB alternative with powerful introspection capabilities", and the phrase that matters is runtime. IRB gives you a prompt; Pry gives you a prompt attached to a specific object or binding inside a program that is already running. That distinction decides who benefits. If you write Ruby libraries, Rails applications or scripts where you need to inspect an object's methods and instance variables at the moment something goes wrong, Pry is aimed at you. If you only ever want to evaluate a snippet of Ruby in isolation, plain IRB already does that.
The project positions itself as "an attempt to bring REPL driven programming to the Ruby language". That is a broader claim than debugging. The README lists source code browsing, documentation browsing, a live help system, opening methods in editors with edit Class#method, syntax highlighting, shell integration, gist integration and history replay as key features. Read that list as the actual scope: Pry is a console with an ecosystem of commands, not a single-purpose breakpoint tool. The maintainer credit in the README is Kyrylo Silin, with John Mair as creator.
How a Pry session attaches to a running program
The mechanism is binding based. According to the README, Pry "can be invoked on any object using the my_object.pry syntax or on the current binding (or any binding) using binding.pry". When the session starts it runs inside the scope of that object or binding, and when you exit, the program continues with any modifications you made. That last clause is the part people underestimate: methods you define inside the session persist, which is what makes hot patching possible and also what makes a stray definition dangerous.
Scope navigation is implemented as commands rather than methods. The README is explicit that commands "are not methods and must start at the beginning of a line, with no whitespace in between". cd moves between objects, ls lists what is in scope, nesting prints the stack of scopes, and jump-to returns to an earlier level. The prompt encodes the current scope and depth, so the README example shows pry(Hello):1 and pry(20):2 as you descend. Commands accept shell-style options, which is why ls -Mp --grep ^pa filters private instance methods by prefix. That option parsing is the reason the command layer exists separately from Ruby evaluation.
A second integration path is the shell. A line beginning with a dot is forwarded to the command shell, so .cd, git and rake work from the prompt, and shell-mode folds the working directory into the prompt. Ruby interpolation with the normal #{} syntax passes values into shell commands. This is convenient and it is also the sharpest edge in the design: the boundary between Ruby evaluation and shell execution is a single leading character.
Installing pry and running a first binding.pry session
The README gives two installation routes. For Bundler, add the gem to your Gemfile with the version constraint it shows:
gem 'pry', '~> 0.15.0'For a manual install, the README gives a single command:
gem install pryPry also ships an executable, so entering pry at the command line starts a session. A pryrc file in $XDG_CONFIG_HOME/pry/ or the user's home directory is loaded if it exists, and pry --help documents the command-line options.
For the runtime case, the README's example requires the library and then calls binding.pry at the point you want to inspect:
# test.rb
require 'pry'
class A
def hello() puts "hello world!" end
end
a = A.new
# start a REPL session
binding.pry
# program resumes here (after pry session)
puts "program resumes here."Run that file with ruby test.rb. Execution stops at binding.pry and you get a prompt in the top-level scope. From there a.hello prints hello world! and returns nil, matching the README's transcript. You can define a method on the instance with def a.goodbye, call it, and then type exit. The string program resumes here. is printed after the session ends, which confirms the resume behaviour described above. If you want to use Pry as a Rails console, the README points to that section of the documentation rather than giving inline steps.
Where Pry is the wrong tool
Pry is a console first. It is not a step debugger in the sense of breakpoints, stepping and watch expressions, and the README does not present it as one. The project's answer to debugging is delegation: the README says plugins provide "remote sessions, full debugging functionality, and more". That means the core gem you install does not give you stepping on its own, and a team that wants a conventional debugger is choosing a plugin stack, not Pry by itself.
The second limitation is the mutation model. Because a session can modify the running program and the program continues afterwards, an accidental method definition or reassignment inside the prompt changes behaviour for the rest of the process. There is no sandbox mentioned in the README. In a long-running server this is exactly what you want for a hot patch and exactly what you do not want during an incident review.
The third is environment compatibility. The README has a Supported Rubies section but the excerpt does not name the versions, so anyone pinning Pry against an older or newer Ruby has to check that section and the gemspec rather than assume. The repository also carries a Dockerfile that installs Ruby 2.1.1 and 2.1.2 via ruby-install, which reflects a much older development environment than the current release line and should not be read as a supported-version statement.
Finally, the command syntax is a real constraint. Commands must begin at column zero with no leading whitespace, which means indented input inside a pasted block is evaluated as Ruby, not as a command. That trips people up when they paste multi-line snippets.
Pry-byebug and the debugger it is not
The most common alternative in Ruby work is Pry-byebug, which appears in the related searches for this project. The difference is architectural rather than cosmetic. Pry provides the console, the command system and the introspection commands; Pry-byebug is a plugin that adds step, next, continue, break and related commands on top of a Pry session. If what you actually need is to stop at a line and walk forward, you want that plugin layer, and installing Pry alone will not give it to you.
Plain IRB is the other reference point, and the README calls Pry an IRB alternative. IRB gives you a REPL with no scope navigation and no command layer. Pry adds cd, ls, nesting, jump-to, source and documentation browsing, and shell forwarding. The trade is complexity: every one of those features is another command to learn, and the README's own overview is organised around teaching them. For a one-off expression evaluation, IRB is less to remember. For exploring an unfamiliar object graph at runtime, Pry's navigation commands are the reason to switch.
Maintenance, releases and licence status
The repository is not archived, and the last push was on 2026-09-20. The most recent release is v0.16.0 from 2025-12-27, following v0.15.2 and v0.15.1 in December 2024. That is a release cadence of roughly one significant version per year in the recent record, so plan upgrades around that rhythm rather than expecting frequent point releases.
Upgrade cost is mostly in the plugin ecosystem and in your pryrc. The README states that Pry allows significant user customization and that a pryrc in $XDG_CONFIG_HOME/pry/ or the home directory is loaded at startup, so local configuration is a file you own and must re-check after a major bump. Any plugin you rely on for debugging or remote sessions has its own compatibility window with the Pry version you pin. The README's key features list also includes gist integration and editor integration, both of which depend on external tools being present in the environment.
On licensing, the repository metadata reports NOASSERTION, which is not an SPDX identifier, so the machine-readable field does not tell you the terms. The repository contains a LICENSE file at the top level. Read that file before redistributing or vendoring the gem; this is a factual pointer, not legal advice, and the licence text rather than the metadata is what governs.
Editorial conclusion
Adopt Pry when you need a REPL inside a live Ruby process and want object navigation, source browsing and shell access from one prompt; skip it if your team already standardises on a debugger such as debug.gem or Pry-byebug and does not need the introspection layer. Before adopting, verify that the pry version you pin supports your Ruby, since the README only says supported Rubies are listed and does not name them, and check the licence text in the repository, because the metadata is NOASSERTION and not an SPDX identifier.
Frequently asked questions
How do I install Pry in a Ruby project?
Add gem 'pry', '~> 0.15.0' to your Gemfile for Bundler, or run gem install pry for a manual install, as shown in the README's Installation section. Pry also ships an executable, so entering pry at the command line starts a session.
How do I start a Pry session inside a running program?
Call binding.pry at the point you want to inspect, or my_object.pry on any object. The README's example stops at binding.pry, opens a session in that scope, and resumes the program at the next line after you exit.
Does Pry work as a debugger with stepping and breakpoints?
Not on its own. The README describes Pry as a runtime developer console and says plugins provide remote sessions and full debugging functionality, so stepping and breakpoints come from a plugin rather than the core gem.
What is the difference between Pry and Pry-byebug?
Pry supplies the console, the command system and the introspection commands such as cd, ls and nesting. Pry-byebug is a plugin that adds debugger commands like step and continue on top of a Pry session, so it complements Pry rather than replacing it.
Where does Pry load its configuration from?
The README states that a pryrc file in $XDG_CONFIG_HOME/pry/ or the user's home directory is loaded if it exists. Pry also supports significant customization beyond that file, according to the README's Overview.
What licence is Pry released under?
The repository metadata reports NOASSERTION, which is not an SPDX identifier, so the metadata does not state the terms. The repository contains a LICENSE file that you should read directly.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/pry-pry)