irb
Run interactive Ruby shell
TLDR
Start the interactive shell
SYNOPSIS
irb [options] [--] [programfile] [arguments]…
PARAMETERS
--help
Display help message
--version
Print IRB version
-r LIBRARY, --require LIBRARY
Require Ruby library before starting
--prompt-mode MODE
Set prompt mode (default, simple, inf-ruby, xmp, null)
--readline
Enable Readline for completion and history
--noprompt
Disable prompt display
--noinspect
Disable inspect method for output
--inspect
Enable inspect for output (default)
--noscript
Disable script trace output
--tracer
Enable automatic trace
--back-trace-limit N
Set backtrace limit (default: 16)
--verbose
Enable verbose output
-d, --debug
Set debug level (equivalent to --debug-level 2)
--inf-ruby-mode
Load inf-ruby-mode for Emacs
--sample-book
Load sample book as initial program
DESCRIPTION
IRB (Interactive RuBy) is a REPL (Read-Eval-Print Loop) tool for the Ruby programming language, providing an interactive environment to execute Ruby code line-by-line from the terminal. Ideal for prototyping, debugging, testing expressions, and learning Ruby, it evaluates input immediately and displays results with inspect formatting.
Key features include multiline editing, command history (with Readline support), exception backtraces, variable inspection via @ or binding.irb, and customizable prompts. Start with irb to enter the shell; type exit or quit to leave. Load libraries with -r, run scripts non-interactively, or embed in Ruby programs.
IRB supports prompt modes like default (>>), simple (%), and inf-ruby for Emacs integration. It's essential for Rubyists, enhancing development workflow alongside tools like pry or byebug. Available on any system with Ruby installed.
CAVEATS
Requires Ruby installation; behavior depends on Ruby version. Readline may need libreadline-dev. Non-interactive mode exits after script.
PROMPT MODES
Customizable prompts:
• default: >> (primary), ? (secondary)
• simple: % >>, %?
• inf-ruby: INF-RUBY >>, INF-RUBY ?
• xmp: ==>
• null: no prompt
EMBEDDING IRB
Embed in Ruby scripts: require 'irb'
IRB.start
Or use binding.irb for contextual debugging.
HISTORY
Developed by Keiju Ishitsuka, IRB debuted in Ruby 1.6 (2000) as Ruby's first interactive shell. Evolved with Ruby releases, adding features like multiline support in 1.8+ and better readline in 1.9+. Now integral to modern Ruby (3.x+).


