Sketches allows you to create and edit Ruby code from the comfort of your editor, while having it safely reloaded in IRB whenever changes to the code are saved.


  • Spawn an editor of your choosing from IRB.
  • Automatically reload your code when it changes.
  • Run the editor in the background.
  • Run the editor in a new terminal.
  • Use a custom editor command.
  • Use a custom terminal command.
  • Use a custom temp directory to store sketches in.


  • Local variables cannot be loaded. Ruby defines local variables as local to the file which they were originally defined in.
  • No support for Inotify or FSevent yet. It would be nice to attempt to use Inotify or FSevent bindings, if available, for efficient polling of sketch files.


Download it here or run:

$ sudo gem install sketches

Then require sketches in your .irbrc file:

require 'sketches'

Sketches can be configured to use a custom editor command:

Sketches.config :editor => 'gvim'

Sketches can also be configured to run in a new terminal:

Sketches.config :editor => 'vim',
                :background => true,
                :terminal => lambda { |cmd|
                  "xterm -fg gray -bg black -e #{cmd.dump}"


  • Open a new sketch:
  • Open a new named sketch:
    sketch :foo
  • Open a sketch from an existing file:
    sketch_from 'path/to/bar.rb'
  • Reopen an existing sketch:
    sketch 2
    sketch :foo
  • List all sketches:
  • Name a sketch:
    name_sketch 2, :foo
  • Save a sketch to an alternant location:
    save_sketch :foo, 'path/to/foo.rb'