Created: 2008-07-09 05:38
Updated: 2017-11-28 11:53
License: isc


Jello Maintenance statusOpen-source licensing detailsChat on FreenodeTwitter followers

Because everybody likes "paste & jello" sandwiches, right? I know I did when I was a kid.

Jello is a simple library to watch the OS X pasteboard and do something on every paste.

require 'jello' do |paste|
  system "say 'You pasted #{paste}'"


For example, to watch for URLs copied, and then shorten the URL and replace the long URL with the shortened one, write a short mould like the following:

require 'open-uri'
require 'jello' do |paste|

  if paste =~ %r{^http://.*}
    uri = $&
    uri.gsub! /#/, '%23'
    unless uri =~ %r{^}
      shortener = '' + uri


Jello.start! :verbose => true

Moulds can even be stacked:

require 'jello' do |paste|
  paste += '123'
end do |paste|
  paste += '456'

Jello.start! :verbose => true

Jello also provides a binary - if you have some moulds you use often, you can throw them in your ~/.jello/ folder (as .rb files), and then run jello with them:

# Assuming ~/.jello/ contains foo.rb, bar.rb, and gaz/{one,two}.rb
$ jello foo bar gaz
# Now foo.rb, bar.rb, one.rb, and two.rb would be executed on incoming
# pastes

You can also use pasteboards other than the general one (see man pbcopy for more information about this):

require 'jello' do |paste|
  paste.gsub! /abc/, 'def'


Finally, you can create a Jello property list for launchd that will keep jello running all the time, even after you restart. Just run rake launchd from the Jello distribution directory. (This requires that you install the LaunchDoctor gem first!)


This project is released for public usage under the terms of the very-permissive ISC license (a modern evolution of the MIT / BSD licenses); more information is available in COPYING.

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more