Configuring irb

irb is remarkably configurable. You can set configuration options with command-line options, from within an initialization file, and while you’re inside irb itself.

irb uses an initialization file in which you can set commonly used options or execute any required Ruby statements. When irb is run, it’ll try to load an initialization file from one of the following sources in order: ~/.irbrc, .irbrc, irb.rc, _irbrc, and $irbrc.

Within the initialization file, you may run any arbitrary Ruby code. For example, you can use require for any gem that you might want included in an irb session (such as irbtools[26] or awesome-print[27]).

You can also set configuration values. The list of configuration variables is given in irb Configuration ...

Get Programming Ruby 3.3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.