Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Monitor a directory for changes and run a shell command, using OS X's FSEvents API

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 Makefile
Octocat-spinner-32 README
Octocat-spinner-32 fswatch.c
README
fswatch.c

This is a small program using the Mac OS X FSEvents API to monitor a directory.
When an event about any change to that directory is received, the specified
shell command is executed by /bin/bash.

usage:

  > ./fswatch /some/dir "echo changed" 

This would monitor /some/dir for any change, and run `echo changed` when
a modification event is received.

fswatch passes along the parent processes' environment, so you can do things
like this:

  > fswatch components/ "~/local/bin/componentize.rb components/ > resources/components.js"

compile:

You'll need the OS X Developer Tools installed on 10.5 or higher.

  > make

This code was adapted from the example program in the FSEvents API pdf.
Something went wrong with that request. Please try again.