1. Technology
Send to a Friend via Email
You can opt-out at any time. Please refer to our privacy policy for contact information.

Spotlight on RubyGems: Wirble

Colorize the IRB


Spotlight on Gems: Wirble

The Wirble RubyGem is one of those little things that you don't know you want until you see it. The Wirble gem will add a splash of color to your IRB sessions, making the sometimes cryptic strings output by the inspect method a lot more readable.

Installing Wirble

Like any other gem, simply use the gem command to install Wirble.

gem install wirble

There is one more step though, and this is to add some code to your irbrc script to load and initialize Wirble when irb starts. The irbrc script runs whenever you run the IRB command, so you can use this for other things as well. On Linux and OSX, the irbrc file is located at ~/.irbrc. On Windows, the file is located at C:\Documents and Settings\<Your Username>\.irbrc. If the irbrc file doesn't exist, simply create it. Enter the following text into your ircrc file.

 # load libraries
 require 'rubygems'
 require 'wirble'
 # start wirble with color

To try it out, type anything into the irb prompt, just as normal. You'll notice that the results will be colored and easier to read.


Installing this gem required you to modify your irbrc file. This might break some things. For example, you can no longer manually load Rubygems. Any file you require after running the IRB command will be required after rubygems and wirble. If, for any reason, you need to start irb without this behavior, run irb command with the -f switch.

$ irb -f
  1. About.com
  2. Technology
  3. Ruby
  4. Gems
  5. Spotlight on RubyGems: Wirble

©2014 About.com. All rights reserved.