fswatch

Monitor directory for file changes and automatically run commands

brewmacoslinux
Try with needOr install directly
Source

About

Monitor a directory for changes and run a shell command

Commands

fswatch

Examples

run tests whenever files change$ fswatch -o . | xargs -n1 -I{} npm test
restart server when code is modified$ fswatch -o src | xargs -n1 -I{} npm restart
recompile markdown to HTML on file save$ fswatch -o docs/*.md | xargs -n1 -I{} markdown {} -o {}.html
rebuild project when source files change$ fswatch src include | make build
sync files to remote server on every change$ fswatch -o . | xargs -n1 -I{} rsync -av . user@host:/backup/