fswatch is a cross-platform file change monitor that detects modifications to files and directories through native operating system APIs.
fswatch solves the problem of detecting file system changes in a portable way by implementing multiple backend monitors tailored to each platform's capabilities. On macOS it uses the File System Events API, on BSD systems it uses kqueue, on Solaris it uses File Events Notification, on Linux it supports both inotify and fanotify, on Windows it uses ReadDirectoryChangesW, and on any other system it falls back to periodic stat-based polling. This multi-backend approach allows the tool to leverage each platform's most efficient notification mechanism while maintaining a consistent interface across systems.
Developers should choose fswatch when they need reliable file monitoring across multiple operating systems without writing platform-specific code. It suits projects that require recursive directory monitoring, filtering based on regular expressions, and customizable output formats. The tool includes both a command-line interface and libfswatch, a library with C, C++, and Go bindings for programmatic use. The kqueue monitor has a notable limitation: it requires an open file descriptor per watched file, which causes poor scaling and potential failures when the process runs out of descriptors. The FSEvents and File Events Notification monitors have no known limitations and scale well.
The project maintains active engagement with issue reporting and contributions. Development activity shows consistent attention to cross-platform compatibility across diverse Unix-like systems and Windows. The codebase demonstrates careful handling of platform-specific APIs and their respective constraints.