watch a file? #3

mfiers opened this Issue Mar 13, 2013 · 7 comments


None yet
6 participants

mfiers commented Mar 13, 2013


Would it be possible to watch a single file instead of a complete directory?



alandipert commented Mar 13, 2013

I don't have a Mac to test with currently, but that might already work. Have you tried it?

Nope, I just checked and it doesn't execute a command after file has been changed.


alandipert commented Mar 14, 2013

Thanks for testing, @longcode. As I don't have a Mac and won't for the foreseeable future, I encourage anyone with the means and interest to implement.

I'm pretty sure the FSEvents API only lets you listen for events at directory paths, so an implementation would probably have to add a listener for the file's parent directory and then filter by filename.

Anyway, it could be a little fun and useful C adventure for somebody.

mfiers commented Mar 15, 2013

I concur - it does not work with only a file. However, I did find kqwait, that does watch single files.


Would love to be able to watch a single file.

Frizlab commented Nov 21, 2013

Since 10.7, you can use the kFSEventStreamCreateFlagFileEvents to monitor file changes.


emcrisostomo commented Apr 27, 2014

Hi all, this use case has been implemented in the upcoming fswatch v. 1.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment