watchexec

Executes commands in response to file modifications

What is watchexec?

Executes commands in response to file modifications

Overview of watchexec

What it is

Watchexec is a simple, standalone tool that watches a path and runs a command whenever it detects modifications. It is designed to automate repetitive tasks during software development.

Key features

  • Simple invocation and use, does not require a cryptic command line involving xargs
  • Runs on OS X, Linux, and Windows
  • Monitors current directory and all subdirectories for changes
  • Coalesces multiple filesystem events into one, for editors that use swap/backup files during saving
  • Loads .gitignore and .ignore files
  • Uses process groups to keep hold of forking programs
  • Provides the paths that changed in environment variables or STDIN
  • Does not require a language runtime, not tied to any particular language or ecosystem

Use cases

  • Automatically run unit tests
  • Run linters/syntax checkers
  • Rebuild artifacts
  • Watch JavaScript, CSS, and HTML files and run npm run build on changes
  • Restart a Python server when Python files change

Getting started

Quick start examples:

$ watchexec -e js,css,html npm run build
$ watchexec -r -e py -- python server.py

Install options:

  • With your package manager for Arch, Debian, Homebrew, Nix, Scoop, Chocolatey…
  • From binary with Binstall: cargo binstall watchexec-cli
  • As pre-built binary package from Github
  • From source with Cargo: cargo install --locked watchexec-cli

License and pricing

Licensed under Apache-2.0. Open source and free to use.

Based on the project's public README and repository metadata.

Add this badge to your README

Featured on YunoDB Badge styles & help

Maintain this project? Show that it is featured on YunoDB.

Markdown[![Featured on YunoDB](https://yunodb.com/badge/watchexecwatchexec.svg)](https://yunodb.com/tools/watchexecwatchexec?utm_source=github&utm_medium=badge)
HTML<a href="https://yunodb.com/tools/watchexecwatchexec?utm_source=github&utm_medium=badge"><img src="https://yunodb.com/badge/watchexecwatchexec.svg" alt="Featured on YunoDB" height="20"></a>