5.3 The kqueue Monitor

The kqueue monitor, available on any *BSD system featuring the kevent function, is very similar in principle to other similar APIs (such as FSEvents and inotify) but has important drawback and limitations.

5.3.1 Peculiarities

The kqueue monitor requires a file deor to be opened for every file being watched. As a result, this monitor scales badly with the number of files being observed and may begin to misbehave as soon as the fswatch process runs out of file deors. In this case, fswatchdumps one error on standard error for every file that cannot be opened so that users are notified and can take action, including terminating the fswatch session. Beware that on some systems the maximum number of file deors that can be opened by a process is set to a very low value (values as low as 256 are not uncommon), even if the operating system may allow a much larger value.

If you are running out of file deors when using this monitor and you cannot reduce the number of observed items, either:

Consider raising the number of maximum open file deors (check your OS’ documentation).Consider using the (--directories, -d) option.Consider using another monitor.