rbtrace ruby debug production mode

Developer from somewhere

This can be useful to debug something in production mode. Add rbtrace to your Gemfile, and start your servers in production mode. In my case, I needed to debug unicorn in production mode. I did a:

ps aux | grep -i unicorn

And found the pid of one of the unicorn worker process. After that:

bundle exec rbtrace -p YOUR_PID -e 'puts Rails.env' # or whatever code you want