IRB stands for interactive ruby, it is a tool for interactively executing ruby expressions read from a standard input. To invoke it, type irb at the shell or command prompt, and begin entering Ruby statements and expressions. But it has some limitations. A solution to this is called ‘irbtools‘, which make using irb easier and more fun. It improves Ruby’s irb console like colored output and lots of helpful methods.


Install the gem by using:


Add it to your project’s Gemfile:


IRB executes code in ~/.irbrc on start-up.To use irbtools, put the following code in ~/.irbrc file:

We can start IRB directly from the code by calling,

When installing irbtools, some gems will not be installed. For example, the bond gem for better auto-completion. These are packaged as irbtools-more (requires ruby version >= 2.4). To use irbtools-more, change the .irbrc to:

and edit Gemfile as

For example, the output looks like:



  1. Colorized and output as comment by wirb and fancy_irb
  2. Nice IRB prompt and IRB’s auto indention
  3. Includes stdlib’s FileUtils: ls, cd, pwd, ln_s, rm, mkdir, touch, cat
  4. Many debugging helpers:
    • ap – awesome_print
    • q –like p, but on one line
    • Object#m – ordered method list (takes integer parameter: level of nesting)
    • Objedt#d – puts the object, returns self (using tap)
  5. “Magical” information constants: Info, OS, RubyVersion, RubyEngine
    • RubyEngine.jruby?
    • 1.9
  6. Clipboard features: copy and paste
  7. Call vim to edit a file, close it and it gets loaded into your current irb session, powered by interactive_editor
  8. Highlight a string with colorize(‘string’) or a file with ray(‘path’), powered by coderay
  9. Displays ActiveRecord database entries as tables with hirb
  10. Restart irb with reset! or change the Ruby version with the use method and rvm!
  11. Includes the current directory in the load path
  12. Shorter requiring like this: rq:mathn
  13. Access to a lot of more commands with boson – call commands to get started

Irbtools Methods

From every_day_irb

ls Returns an array with the directory’s content
cat Shortcut for
rq Shortcut for require library.to_s (allows concise syntax like rq:mathn)
ld Shortcut for load library.to_s + '.rb'
rrq/rerequire Little hack for rerequiring a library
reset! Restarts IRB
clear Clears the terminal (system "clear")
session_history Returns all issued commands as a string

From irbtools in conjunction with the libraries

cd Improves the cd that is already provided by fileutils (try cd ‘-‘)
version Displays RubyVersion
engine Displays RubyEngine
os OS information
info Aggregates information about your Ruby environment
copy Shortcut for Clipboard.copy
paste Shortcut for Clipboard.paste
copy_input Copies the session_history to the clipboard
copy_output Copies this session’s results to the clipboard
mf Shortcut for using the methodfinder
page Shortcut for using the pager from hirb
colorize Syntax highlights a ruby string using coderay
ray Syntax highlights a ruby file using coderay

So next time when you think of improving Ruby’s irb console into a colored, fun and much easier output, don’t forget to remember your friend named irbtools‘.