Byebug is a simple to use and feature rich debugger for Ruby. It uses the TracePoint API for execution control and the Debug Inspector API for call stack navigation. Therefore, Byebug doesn't depend on internal core sources. Byebug is also fast because it is developed as a C extension and reliable because it is supported by a full test suite.
The debugger permits the ability to understand what is going on inside a Ruby program while it executes and offers many of the traditional debugging features such as:
Byebug for enterprise is available via the Tidelift Subscription. Learn more.
next
command).gem install byebug
Alternatively, if you use bundler
:
bundle add byebug --group "development, test"
Simply include byebug
wherever you want to start debugging and the execution will
stop there. For example, if you were debugging Rails, you would add byebug
to
your code:
def index
byebug
@articles = Article.find_recent
end
And then start a Rails server:
bin/rails s
Once the execution gets to your byebug
command, you will receive a debugging prompt.
If you want to debug a Ruby script without editing it, you can invoke byebug from the command line.
byebug myscript.rb
Command | Aliases | Subcommands |
---|---|---|
backtrace |
bt w where |
|
break |
b |
|
catch |
cat |
|
condition |
cond |
|
continue |
c cont |
|
continue! |
c! cont! |
|
debug |
||
delete |
del |
|
disable |
dis |
breakpoints display |
display |
disp |
|
down |
||
edit |
ed |
|
enable |
en |
breakpoints display |
finish |
fin |
|
frame |
f |
|
help |
h |
|
history |
hist |
|
info |
i |
args breakpoints catch display file line program |
interrupt |
int |
|
irb |
||
kill |
||
list |
l |
|
method |
m |
instance |
next |
n |
|
pry |
||
quit |
q |
|
quit! |
q! |
|
restart |
||
save |
sa |
|
set |
autoirb autolist autopry autosave basename callstyle fullpath histfile histsize linetrace listsize post_mortem savefile stack_on_error width |
|
show |
autoirb autolist autopry autosave basename callstyle fullpath histfile histsize linetrace listsize post_mortem savefile stack_on_error width |
|
skip |
sk |
|
source |
so |
|
step |
s |
|
thread |
th |
current list resume stop switch |
tracevar |
tr |
|
undisplay |
undisp |
|
untracevar |
untr |
|
up |
||
var |
v |
all constant global instance local |
Byebug attempts to follow semantic versioning and
bump major version only when backwards incompatible changes are released.
Backwards compatibility is targeted to pry-byebug and any other plugins
relying on byebug
.
Read byebug's markdown guide to get started. Proper documentation will be eventually written.
next
, step
, finish
, continue
and break
commands
to pry
using byebug
.See Getting Started with Development.
Subscribe to Tidelift to ensure byebug stays actively maintained, and at the same time get licensing assurances and timely security notifications for your open source dependencies.
You can also help byebug
by leaving a small (or big) tip through Liberapay.
Please use the Tidelift security contact to report a security vulnerability. Tidelift will coordinate the fix and disclosure.
Everybody who has ever contributed to this forked and reforked piece of software, especially: