Debugging in Ruby 2
yui-knk and deivid-rodriguez Make `program_with_two_breakpoints` has exactly 2 breakpoints (#517)
This test case was introduced as a regression test of
in #406.

The description of issues/274 says an exception will be raised
if the byebug CLI is terminated when main program is sleeping.

Before this commit there are 2 breakpoints (`byebug` method call)
before `sleep 3` and `"cont"` is called once because the arugment of
`remote_debug_connect_and_interrupt` is `"cont"`.
I think this is not intended.

And the method name of test case is `program_with_two_breakpoints`,
on the other hand the program had 3 breakpoints (`byebug`).
Latest commit 49f524e Dec 8, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Use CircleCI 2.1 Oct 21, 2018
.github Remove PR template (#354) Sep 15, 2017
bin Bump rubocop from 0.59.2 to 0.60.0 (#502) Nov 20, 2018
docker Use alpine 3.8 as base image (#514) Dec 5, 2018
exe Move LOAD_PATH manipulation to gemspec (#422) Jan 7, 2018
ext/byebug Rename functions that conflict with debase's (#447) Mar 30, 2018
lib Bump rubocop from 0.59.2 to 0.60.0 (#502) Nov 20, 2018
tasks Reconcile clang-format version Nov 15, 2018
test Make `program_with_two_breakpoints` has exactly 2 breakpoints (#517) Dec 8, 2018
.clang-format Move to clang-format for C code formatting Dec 2, 2017
.codeclimate.yml Disable the rest of codeclimate checks Jul 25, 2018
.gitignore Update readme files Dec 7, 2017
.mdlrc Normalize string literals in mdlrc config Jan 6, 2018
.rubocop.yml Officially drop ruby 2.2 support Oct 10, 2018
.simplecov Fix rubocop config to include `.simplecov` Jan 6, 2018 Add change log entry Oct 10, 2018 Stop testing on macOS (#508) Nov 16, 2018 Migrate links to https Aug 28, 2018
Gemfile Bump rubocop from 0.60.0 to 0.61.1 (#515) Dec 6, 2018
Gemfile.lock Bump rake from 12.3.1 to 12.3.2 (#516) Dec 7, 2018
LICENSE Update email address in license and coc Sep 19, 2018 Stop testing on macOS (#508) Nov 16, 2018
Rakefile Add task to run docker stuff for the default image Aug 31, 2018 Drop official support for ruby 2.2 Dec 30, 2017
appveyor.yml Remove force_ruby_platform setting from appveyor (#512) Nov 23, 2018
byebug.gemspec Officially drop ruby 2.2 support Oct 10, 2018 Update email address in license and coc Sep 19, 2018


Version Tidelift Coverage Gitter

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:

  • Stepping: Running your program one line at a time.
  • Breaking: Pausing the program at some event or specified instruction, to examine the current state.
  • Evaluating: Basic REPL functionality, although pry does a better job at that.
  • Tracking: Keeping track of the different values of your variables or the different lines executed by your program.

Build Status

Linux Cir Windows Vey


MRI 2.3.0 or higher.


gem install byebug

Alternatively, if you use bundler:

bundle add byebug --group "development, test"


From within the Ruby code

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
  @articles = Article.find_recent

And then start a Rails server:

bin/rails s

Once the execution gets to your byebug command, you will receive a debugging prompt.

From the command line

If you want to debug a Ruby script without editing it, you can invoke byebug from the command line.

byebug myscript.rb

Byebug's commands

Command Aliases Subcommands
backtrace bt where
disable breakpoints display
enable breakpoints display
info args breakpoints catch display file line program
method instance
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
thread current list resume stop switch
var all constant global instance local

Semantic Versioning

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.

Getting Started

Read byebug's markdown guide to get started. Proper documentation will be eventually written.

Related projects

  • pry-byebug adds next, step, finish, continue and break commands to pry using byebug.
  • ruby-debug-passenger adds a rake task that restarts Passenger with Byebug connected.
  • minitest-byebug starts a byebug session on minitest failures.
  • sublime_debugger provides a plugin for ruby debugging on Sublime Text.
  • atom-byebug provides integration with the Atom editor [EXPERIMENTAL].


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.


Everybody who has ever contributed to this forked and reforked piece of software, especially:

  • @ko1, author of the awesome TracePoint API for Ruby.
  • @cldwalker, debugger's maintainer.
  • @denofevil, author of debase, the starting point of this.
  • @kevjames3 for testing, bug reports and the interest in the project.
  • @FooBarWidget for working and helping with remote debugging.