watchexec watches directories and reruns commands on file changes, coalescing editor save events. It works across Linux, macOS, and Windows without a language runtime.
Overview
watchexec is a standalone Rust binary for developers tired of manually rerunning builds, tests, or linters after each save. It monitors the working tree recursively, merges rapid filesystem events, and spawns configured commands with optional restart semantics.
Filters honor .gitignore and .ignore files, and changed paths can be passed via environment variables or STDIN. Process groups keep child trees contained, which helps servers that fork workers.
Packaging includes distribution packages, GitHub release binaries, and cargo install watchexec-cli. Related crates split event typing, supervisors, and ignore handling for custom tools built on the same engine.
Documentation covers interactive modes, extension filters, and integrations such as Cargo Watch for Rust workflows. Examples show watching JS, CSS, and HTML to run npm run build or restarting Python servers on .py changes.
Key features
- Recursive directory change monitoring
- Command rerun with optional restart flag
- Editor save event coalescing
- Respects .gitignore and .ignore
- Cross-platform macOS, Linux, Windows binary
- Changed path info via env or STDIN
- Process group management for children
- Extension and glob filtering flags
Use cases
- Auto-running unit tests on edits
- Restarting dev servers on code edits
- Rebuilding frontend assets on save
- Linting Python trees on file changes