Not able to inspect anything; D.O.A. after binding.pry
Author: rhuppertCreated May 11, 2018Updated Sep 3, 2025
I'm sure there must be something conflicting with pry on my system and not a bug in pry.
I am currently running Rails 5.1.6, Ruby 2.4.4, pry-rails 0.3.6, coderay 1.1.2, Ubuntu 16.04. This app was initially created under Rails 3.1.x.
With pry-rails, it works properly. In other words, when running in the rails console, I can inspect variables. Running from the app itself is another story.
After entering binding.pry and running the app, I go to the server and see:
App 12704 output: From: /app/controllers/groups_controller.rb @ line 12 GroupsController#show:
App 12704 output:
App 12704 output: 10: def show
App 12704 output: 11: binding.pry
App 12704 output: => 12: set_meta_tags title: "Group Members"
App 12704 output: 13: @group ||= Group.includes(:activity, :memberships, :users).friendly.find(params[:id])
App 12704 output: 14: session[:last_page] = request.env['HTTP_REFERER'] || groups_path
App 12704 output: 15: end
App 12704 output:
App 12704 output:
App 12704 output: [1] (pry) #<GroupsController>: 0>
... I can enter commands here, but no responses and not able to exitMy cursor is placed on a new line and that is as far as I can go. I have to CTRL-C to exit the server and reload. I've tried a number of things, all with the same result.
- removed pry-bybug
- removed pry-rails
- used pry by itself
Here is my .pryrc
# require "awesome_print"
# AwesomePrint.pry!
Pry.config.theme = "railscasts"
Pry.config.editor = 'subl'
## Useful Collections
def a_array
(1..6).to_a
end
def a_hash
{hello: "world", free: "of charge"}
end
# Pry.config.pager = true
Pry.config.color = true
Pry.config.prompt = Pry::NAV_PROMPT
Pry.config.commands.alias_command "h", "hist -T 20", desc: "Last 20 commands"
Pry.config.commands.alias_command "hg", "hist -T 20 -G", desc: "Up to 20 commands matching expression"
Pry.config.commands.alias_command "hG", "hist -G", desc: "Commands matching expression ever used"
Pry.config.commands.alias_command "hr", "hist -r", desc: "hist -r <command number> to run a command"
begin
require 'awesome_print'
# Pry.config.print = proc { |output, value| output.puts value.ai }
AwesomePrint.pry!
rescue LoadError => err
puts "no awesome_print :("
end
if defined?(PryByebug)
Pry.commands.alias_command 'c', 'continue'
Pry.commands.alias_command 's', 'step'
Pry.commands.alias_command 'n', 'next'
Pry.commands.alias_command 'f', 'finish'
end
# Hit Enter to repeat last command
Pry::Commands.command /^$/, "repeat last command" do
_pry_.run_command Pry.history.to_a.last
end
puts "Loaded ~/.pryrc"
puts
puts "Helpful shortcuts:"
puts "h : hist -T 20 Last 20 commands"
puts "hg : hist -T 20 -G Up to 20 commands matching expression"
puts "hG : hist -G Commands matching expression ever used"
puts "hr : hist -r hist -r <command number> to run a command"
puts
puts "Samples variables"
puts "a_array : [1, 2, 3, 4, 5, 6]"
puts "a_hash : { hello: \"world\", free: \"of charge\" }"Any suggestion appreciated.
Source: pry/pry