Cargo Watch watches over your project's source for changes, and runs Cargo

If you've used guard, or watchexec

$ cargo watch

Cargo Watch watches over your project's source for changes, and runs Cargo commands when they occur.

If you've used nodemon, guard, or entr, it will probably feel familiar.

  • License: Apache 2.0.
  • Website:
  • Minimum Supported Rust Version: 1.58.0.


Pre-built binaries are available from the website or alternatively on the Github Releases tab.

With cargo-binstall:

With cargo:

From source:

This repository contains a manual page and shell completions that you may want to install; the pre-built packages also include these.


By default, it runs check. You can easily override this, though:

A few examples:

There's a lot more you can do! Check out:

  • Usage guide
  • Manual page
  • Troubleshooting


Created by Félix Saparelli and awesome contributors.


Collection of the latest Issues



Comment Icon11

Hi! Thank you for a great tool :-)

I'm currently experiencing cargo watch -x test looping indefinitely, with --why reporting that the cause is a file that hasn't been modified (the file is read during cargo test and copied to a temp dir, but the original isn't modified itself).

I was wondering if you might have some insight?

Steps to reproduce:

  1. git clone (currently at fd1686f8d0fe07aca5e0b9592fbdee1919591fdb)
  2. cd
  3. cargo watch -x test --why


Test command is run only once, and waits for next modification to the project source before being re-run.


Test command is run repeatedly in a loop.

Output says:

Stating the files before/after shows nothing has changed:

During the test setup, the files in question are copied to a temporary directory here using fs_extra::dir::copy():

...but the target directory is in TMP and so not watched, and the source file was never modified.

Additional information

Cargo watch was installed using cargo install cargo-watch (I reinstalled just now using --force to ensure it was recently compiled, given not using --locked).


(though this also repros on Rust stable)

This is on macOS 12.2.



Comment Icon0

Out-of-bounds write in nix::unistd::getgrouplist

Package nix
Version 0.17.0
Date 2021-09-27
Patched versions ^0.20.2,^0.21.2,^0.22.2,>=0.23.0
Unaffected versions <0.16.0

On certain platforms, if a user has more than 16 groups, the nix::unistd::getgrouplist function will call the libc getgrouplist function with a length parameter greater than the size of the buffer it provides, resulting in an out-of-bounds write and memory corruption.

The libc getgrouplist function takes an in/out parameter ngroups specifying the size of the group buffer. When the buffer is too small to hold all of the reqested user's group memberships, some libc implementations, including glibc and Solaris libc, will modify ngroups to indicate the actual number of groups for the user, in addition to returning an error. The version of nix::unistd::getgrouplist in nix 0.16.0 and up will resize the buffer to twice its size, but will not read or modify the ngroups variable. Thus, if the user has more than twice as many groups as the initial buffer size of 8, the next call to getgrouplist will then write past the end of the buffer.

The issue would require editing /etc/groups to exploit, which is usually only editable by the root user.

See advisory page for additional details.



Comment Icon0

Not entirely sure if this is even possible, but once we've got #117, a further step could be to run the or catch its output somehow and obtain the cargo:rerun-if-changed= entries for further files to watch.



help wanted
Comment Icon4

It's useful to have a capability to take local dependencies (with paths) into accounts. It's not the same #52, it's about watching for deps like these:



Comment Icon6

How do I instruct cargo watch to exclude folders? Doesn't seem to be supported so far, by the looks of cargo watch --help | grep exclude.



help wanted
Comment Icon11

Consider adding support to use cargo watch in a workspace project.

You can see with cargo +nightly build --help the kind of options for workspace projects.


Find the latest versions by id

v8.1.2 - Nov 16, 2021

Never released to

v8.1.1 - Sep 22, 2021

To be yanked from (pending release of 9.0)

  • Releng: Experimental: RPM packages are now available. These are built from the same binaries in the tarballs and DEB packages, so may not work properly for distros due to glibc versions or whatever. Untested as I don’t run RPM-based distros, tell me how it goes.
  • CI: Cross build targets + FreeBSD are now checked.
  • Workaround: -N / desktop notifications are disabled on FreeBSD (#184)

v8.1.0 - Sep 21, 2021

Yanked from on 2022-01-22

  • New: the -B option injects RUST_BACKTRACE into the environment, which is a fairly common thing to do when catching panics. Use like: cargo watch -B1 -x run (tweet)
  • Fix: quoting issues with Zsh (#183)
  • Metadata: The rust-version field is now used in the Cargo.toml. This will generate a warning when compiling until rustc 1.56.
  • Releng: this is the first release with native Apple M1 binaries!

v8.0.0 - Jul 30, 2021

Never released to

  • Breaking change: #177 the order of -x and -s is now respected. (This never actually happened. The code was not merged.)

    Example: cargo watch -s 'echo before' -x test -s 'echo after' Before: would run cargo test && echo before && echo after. Now: runs echo before && cargo test && echo after.

  • Experimental: --notify/-N flag sends a desktop notification when a change is observed (which may or may not trigger a command restart). While objectively the better behaviour would be to notify on command finish and vary the notification on exit status, we just can't do that at the moment with the current architecture.

v7.8.1 - Jul 15, 2021

  • New: there’s now a website. Some of it is still being drafted, notably dedicated general documentation for this tool, but there’s already some specific documentation that’s been brought over and rewritten/improved, such as the inotify limitations and the glob patterns pages. Eventually a lot of the documentation that’s in the readme will be moved there, so the readme can become a much leaner page with only the important bits, and the information moved over will have a lot more space to really shine.
  • Meta: moved to the watchexec github organisation. As well as bringing these very related projects together under one umbrella, this should make the maintaining relationship much clearer. As a bonus, that enables Github’s tooling to move issues to a different repo.
  • Deps: updated to watchexec 1.16.1, which pins the globset crate to version 0.4.6. While not a good long-term fix, this fixes issues installing via cargo install cargo-watch yielding buggy (#176) builds without --locked.
  • Releng: in 7.8.0, binary release builds got checksums and signatures, but generated a combined CHECKSUMS file with both SHA512 and BLAKE3 checksums, which causes warnings to be emitted when checking with the sha512sum or b3sum tools, as well as being a bit ambiguous. In this release, checksums go in separate files, one for each checksum algorithm; these files are also signed separately. I also retroactively fixed that in the 7.8.0 release. The release download list on GitHub is becoming quite long! The one on the website is a lot easier to use.
  • Packagers: if you’re reading these notes:
    • The website now has a JSON metadata file for every release and the latest, and that’s probably easier to parse than fighting it out with the API and the filenames. It also has the release notes and the checksums in nicely machine readable locations if you’re into that.
    • The archive format for tarballs will change to ZStandard (.tar.zst) at some point in the future, probably around version 8.

v7.8.0 - May 01, 2021

  • #172 Restore and document the behaviour where the directory is changed to the project/crate root by default, not the workspace root, as introduced by 7.7.1
  • New: -C/--workdir option to change the working directory to a custom location. Note that this will behave very strangely in combination with other path options (like -w/--watch) until real support is added upstream, cf watchexec/watchexec#188.
  • New: logo.
  • New: Windows ARM builds.
  • New: checksums and release signing.

v7.7.2 - Apr 30, 2021

v7.7.1 - Apr 29, 2021

  • Use cargo metadata crate to replace cargo root finding logic
  • Update insta test helper to maybe help on the cross-platform front (#170)
  • Include module path in debug logging
  • Update other deps
  • Remove dependence on an empty tests/touchdata directory for tests to pass
  • Run tests in CI again (on Linux)
  • Be a little more flexible on the version of watchexec (not quite semver yet!)

v7.7.0 - Apr 11, 2021

  • Issue policy change / clarification: if an issue is a watchexec issue, it should go there, and issues opened here that ultimately are upstream issues will get moved/closed.
  • Upgrade to watchexec 1.15.
    • Add --shell option
    • Add --why switch
  • Add a manpage (cargo-watch in section 1)
  • Add Zsh completions (try them out and tell me if they work well!)

v7.6.1 - Mar 29, 2021

  • #167 — add escaping to trailing command

v7.6.0 - Mar 29, 2021

  • #97 We now support the cargo watch -- command... syntax style. That should make it a little more intuitive to those used to comparable unix tools.
  • GNU builds on Windows have been dropped
  • ARM v7 (hf) and v8 (aarch64) binaries are now available
  • DEBs are now available for both amd64 gnu and musl (if that's useful in some way), and for ARM builds
  • Builds are done on Github Actions (and are super fast! :rocket:)
  • MSRV has been bumped to 1.51.0 (not a breaking change as per policy)

v7.5.1 - Mar 07, 2021

No code changes this release.

v7.5.0 - Jul 04, 2020

  • Log format (debugs and warnings) changed as part of the upgrade to watchexec 1.14
  • WATCHEXEC_* environment variables are not set for subprocesses anymore. I didn't actually intend to have them in the first place, but chime in if you rely on them!
  • #152 New --features option to pass the --features flag to a selection of cargo commands that support them. E.g. cargo watch --features feat -x check -x test can now be used instead of cargo watch -x 'check --features feat' -x 'test --features feat'.
  • Also fixes a bug where a polling message was shown even when --quiet was given.


v7.4.1 - Jun 06, 2020

  • #149: if watched directory didn't contain a .git folder, thread would block (infinite loop)
  • Also, #BlackLivesMatter. Closer to home, #ArmsDownNZ (police here wants to arm up, fuck that). Over the pond, #AboriginalLivesMatter. #JunkTerrorBill a bit further away, and spare a thought for Hong Kong, which has been fighting since March last year! I'm not comfortable stating that on Watchexec (which I also maintain and is released concurrently) given it's not, originally, my project, but here I can.

v7.4.0 - Jun 04, 2020

  • #147 (pulling in watchexec 1.13): now gitignores in subdirs are also honoured
  • #137: MSRV is documented now, as well as the versioning policy when bumping MSRV

v7.3.0 - Nov 19, 2019

  • Watchexec 1.12.0
  • More documentation on ignore files (e4e13bee30016d5ee2babfe3d7f739fcaee07cc6)
  • Bring in --no-ignore support from upstream (#133)
  • Bring in --watch-when-idle support from upstream (329aa33f4ddcff5dbb1c291f69c1f7a8d7709025)
  • FYI: from upstream has improved --ignore handling!

v7.2.2 - Oct 28, 2019

From upstream watchexec: .ignore files are now supported.

v7.2.1 - Apr 08, 2019

v7.2.0 - Feb 18, 2019

  • Fixed a crash on error due to an upstream bug.
  • Allowed direct invocation without the watch argument, such that all these now do the same: (#114)

v7.1.1 - Jan 29, 2019

  • Fixed a bug on Windows where the wrong command separator was being used (#113)
  • Added exit code to the finish message in windows, similar to unixes.

v7.1.0 - Jan 27, 2019

  • No more quotes or escapes for the start/finish messages, fixing #112.
  • The start message was brought into Rust code rather than shell, so quoting doesn't affect it anymore! This may help a few other issues (e.g. #107).
  • The finish message is printed regardless of whether the command is successful or not.
  • On unixes only for now, the exit status is now reported as part of the finish message.
  • LTO and codegen optimisations are now enabled for release builds.

v7.0.9 - Jan 26, 2019

v7.0.8 - Dec 29, 2018

v7.0.7 - Oct 29, 2018 — SQLite files are now ignored by default

v7.0.6 - Oct 19, 2018

As well as the GNU ones.

v7.0.5 - Oct 19, 2018

#100 — thanks to Bruce Guenter — patch

v7.0.4 - Sep 09, 2018

v7.0.3 - Sep 09, 2018

v7.0.2 - Aug 21, 2018

  • Updated watchexec
  • Set up CI for automated builds to releases

v7.0.1 - Aug 21, 2018

#96 — On Windows, fix build — patch

Information - Updated Apr 17, 2022

Stars: 1.7K
Forks: 66
Issues: 7


A template for writing mods for Quest il2cpp games in Rust using cargo generate to clone the template:


Command line json text parsing and processing utility

parsing json compliant with rust and cargo

Command line json text parsing and processing utility

Clone this repo: git clone

If you don't have Rust and cargo-make installed,

Clone this repo: git clone

Rustup: the Rust installer and version management tool

To test that you have Rust and Cargo installed, you can run this in your terminal of choice: cargo --version

Rustup: the Rust installer and version management tool

Address generator in Rust

If you have Rust: cargo install gemgen

Address generator in Rust

First, complete the basic Rust setup instructions

Use Rust's native cargo command to build and launch the template node:

First, complete the basic Rust setup instructions

cargo rssc - Rust scripts for crates building

will copy the template_basic into scripts_rssc folder

cargo rssc - Rust scripts for crates building

NES Emulator in Rust-WASM

Requires Rust with cargo, nodejs, and wasm-pack

NES Emulator in Rust-WASM

Terraformer Engine

A 3D game engine but completely in rust/std/cargo

Terraformer Engine

Rustup: the Rust installer and version management tool

To test that you have Rust and Cargo installed, you can run this in your terminal of choice: cargo --version

Rustup: the Rust installer and version management tool
Facebook Instagram Twitter GitHub Dribbble