Is there a way to get a better format of output with byebug? When I print objects the output is a little hard to read, would be better with colors similar to Awesome Print
.

- 5,603
- 9
- 39
- 61
-
3Use your pp. Try `require "pp"` and when inspecting objects use `pp object`. – DiegoSalazar Dec 02 '15 at 00:01
-
...or just use awesome_print? – Jordan Running Dec 02 '15 at 01:56
-
Pry has been super helpful, but that's more about line formatting than color. – Lanny Bose Dec 02 '15 at 08:13
4 Answers
There is no native option on byebug to format the output with colors, but there is a Gem you can use to colorize some of byebug output for ease of readability, which I think is what you are aiming here.
Please follow this link to see instructions on how to install byebug-color-printer Gem. https://github.com/ahmadsherif/byebug-color-printer
Or you could use pry. https://github.com/pry/pry :)
Let me know how this works for you. I hope it helps.

- 489
- 5
- 10
-
3byebug-color-printer won't work unless you want to use a very old version of byebug: https://github.com/ahmadsherif/byebug-color-printer/blob/master/byebug-color-printer.gemspec#L21 – Gerry Aug 27 '16 at 07:30
If you add awesome_print
to your project (via the Gemfile if you use bundler), then ap will be available to you inside byebug
.

- 397
- 4
- 10
debug.rb (aka binding.break)
Consider using a new Ruby debugging tool called debug.rb.
It supports syntax highlighting and many more out-of-the-box.
Also, it is worth mentioning that it is developed by the Ruby core team.
Just place binding.break
anywhere in your codebase.
Here is an example:
Also, it is a default Rails debugger starting from version 7.
Notes:
- Do not forget about
require 'debug'
q # quit command
Sources:

- 7,740
- 2
- 47
- 51