Executes commands in response to file modifications
Watchexec is a simple, standalone tool that watches files and directories for changes and automatically runs commands when modifications are detected. It eliminates the repetitive nature of software development by automating common tasks like running unit tests, linting code, or rebuilding artifacts whenever source files change.
The tool stands out for its simplicity and cross-platform compatibility, running on macOS, Linux, and Windows without requiring complex command line syntax or language runtimes. It intelligently coalesces multiple filesystem events into one (useful for editors that create swap/backup files), respects .gitignore and .ignore files, and provides changed file paths through environment variables or STDIN.
Watchexec is designed for developers who want to streamline their workflow without being tied to any particular programming language or ecosystem. Whether you're working with JavaScript, Python, Rust, or any other language, watchexec can help automate your development tasks. The tool also serves as a foundation for more specialized tools, with an ecosystem of related crates and downstream projects like cargo-watch for Rust development and ghciwatch for Haskell projects.
# via Package Manager
See package manager options for Homebrew, Apt, Nix, Scoop, etc.
# via Cargo
cargo install --locked watchexec-cli
# via Cargo Binstall
cargo binstall watchexec-cli