Pusher guard allows to automatically send a Pusher message to any number of browsers when files are modified.
Latest commit 3111fb2 Jun 14, 2012 @carhartl updating version number



Pusher guard allows to automatically send a Pusher message to any number of browserswhen files are modified. That message can for instance be used to reload a page during development. Sort of Livereload but for iPad, iPhone etc. without the ability to install the necessary extension.

  • Tested on Ruby 1.8.7 & 1.9.2.


Please be sure to have Guard installed before continue.

Install the gem:

gem install guard-pusher

Or add it to your Gemfile

gem 'guard-pusher'

and run

bundle install

Add guard definition to your Guardfile by running this command:

guard init pusher

Get a free Pusher developer account: pusherapp.com (also available as Heroku add-on).

Create a YAML file containing your API credentials for the development environment and save it in the config directory:

# config/pusher.yml
  app_id: ...
  key: ...
  secret: ...

You can also pass these credentials as option in your guard definition, see Options below.

Include the following JavaScript:

<script src="http://js.pusherapp.com/1.8/pusher.min.js"></script>
    new Pusher(<key>).subscribe('guard-pusher').bind('guard', function() {
        // do something - for instance simply reload the page:


Please read Guard usage doc


Pass Pusher API credentials as option:

guard 'pusher', :app_id => ..., :key => '...', :secret => '...' do

Set the name of the event you're binding to:

guard 'pusher', :event => 'ping' do

new Pusher(...).subscribe('guard-pusher').bind('ping', function() { ... });


Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change you make.


Klaus Hartl