QR Code contains TinyURL of this article.Guard/nanoc Notifications on OS X

Here’s a nice little tip for those of you who use nanoc to maintain your static website. If you’re running OS X 10.8+ you can send your Guard/nanoc messages to the Notification Center using TerminalNotifier for Guard. This saves having to switch between editor, browser and the terminal when you’re working on your website and waiting for a nanoc compile to complete.

Here’s how it set it up on OS X Mavericks:

Install TerminalNotifier for Guard1 in the Terminal:

$ sudo gem install terminal-notifier-guard

Create, or edit the Gemfile in the root directory of your project and add a gem 'terminal-notifier-guard' directive.

For example:2

group :development do
  gem 'guard-nanoc'
  gem 'terminal-notifier-guard'
  gem 'typogruby'
  gem 'builder'
  gem 'kramdown'
  gem 'nokogiri'
  gem 'pygments.rb'

Then, back in the Terminal:

$ bundle

You should now be able to run Guard inside your nanoc project as follows:

$ bundle exec guard

If all has gone well then you will now get nanoc/Guard messages in the Notification Center, which is perfect for compilation status messages.

  1. Assuming that you are already using Guard to initiate nanoc compiles. If not, you should! ↩︎

  2. Note: Your Gemfile is most likely different to mine. The one listed here is for illustration only. ↩︎