Run arbitrary commands when files change

project page

entr uses one file descriptor for each file and directory under watch. This poses a problem when watching a large code base since the default limit imposed by some operating systems is very low (on MacOS this usually 256).

Use the following instructions to set a default that is more reasonable for your use case. For simplicity, we assume that a reboot after changing configuration.


Modify /etc/login.conf



Install a new property list file

cd /Library/LaunchDaemons
sudo curl -sO http://eradman.com/entrproject/etc/limit.maxfiles.plist


The maximum number of open files (per process) on most Linux distributions the is generous, and usually dos not need to be changed. To raised this limit, edit the following line in /etc/security/limits.conf

*       hard    nofile  16384

If others processes are also watching files you may an error such as “Unable to allocate memory” or “No space left on device”. In this case add the following line to /etc/sysctl.conf

fs.inotify.max_user_watches = 100000

Last updated on November 20, 2018
Send questions or comments to ericshane@eradman.com