# 使用 Homebrew, apk, MacPorts, Nix, pacman, zypper, scoop 安装 watchexec

查看 watchexec 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:watchexec
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install watchexec
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install watchexec
```

  证据: MacPorts ports tree: sysutils/watchexec/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- apk (92%):

```sh
sudo apk add watchexec
```

  证据: Alpine Linux edge package indexes: watchexec from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz

- Nix (92%):

```sh
nix profile install nixpkgs#watchexec
```

  证据: nixpkgs package indexes: pkgs/by-name/wa/watchexec/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- pacman (92%):

```sh
sudo pacman -S watchexec
```

  证据: Arch Linux sync databases: watchexec from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

- zypper (92%):

```sh
sudo zypper install watchexec
```

  证据: openSUSE Tumbleweed package metadata: watchexec from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

### Windows

- Scoop (92%):

```sh
scoop install main/watchexec
```

  证据: Scoop official bucket manifest trees: bucket/watchexec.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1

## 软件包事实

- **软件包键:** brew:watchexec
- **软件包管理器:** Homebrew
- **版本:** 2.5.1
- **来源摘要:** Execute commands when watched files change
- **主页:** <https://watchexec.github.io/>
- **仓库:** <https://github.com/watchexec/watchexec>
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- watchexec (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 2.5.1
## 项目历史与用法

watchexec is a Rust command-line tool that watches files and runs commands when they change. It is aimed at software-development feedback loops: rebuild, retest, rerun a server, invoke a linter, or emit structured file-change events without binding the workflow to one programming language or build system.

### 项目历史

The public GitHub repository dates to September 18, 2016, and the GitHub release feed records an early 1.5.0 release on November 23, 2016. The project has since grown from a standalone file-watcher command into what its citation metadata calls both a tool and a crate ecosystem, with the CLI, reusable library crates, event types, signal support, process supervision, ignore-file handling, project-origin helpers, and related utilities.

The current README emphasizes cross-platform behavior on OS X/macOS, Linux, Windows, and more, along with practical details that matter in real projects: recursive watching, coalescing editor save bursts, loading `.gitignore` and `.ignore`, process-group handling, exposing changed paths through environment variables or JSON on stdin, and avoiding any required language runtime. The 2026 citation metadata identifies version 2.5.1, released March 30, 2026, and credits Matt Green and Felix Saparelli.

### 采用历史

watchexec's adoption is visible in both packaging breadth and downstream specialization. The upstream package list distinguishes first-party binary packages, distro packages, Homebrew and MacPorts, Windows packaging through Scoop and Chocolatey, and installation through Cargo or cargo-binstall. The README also lists downstreams such as cargo-watch, cargo-lambda, devenv.sh, dotter, ghciwatch, and Tectonic, showing that watchexec is used both as an executable and as infrastructure for other developer tools.

The repository page reports roughly seven thousand stars and more than one hundred releases, which is substantial for a general-purpose CLI watcher. More importantly, the project's anti-feature is part of its adoption story: it is intentionally not tied to Git, not tied to a language ecosystem, and not a wrapper requiring cryptic `xargs` pipelines.

### 使用方式

Common invocations are direct and task-shaped: watch JavaScript, CSS, and HTML files and run `npm run build`; restart `python server.py` when Python files change; run `make test` while ignoring `target`; send a signal instead of restarting; or emit JSON events to stdout for another program to consume. The CLI README documents extension filters, watch roots, ignore patterns, desktop notifications, timings, shell selection, process groups, and generated completions/manual pages.

In package-maintainer and developer workflows, watchexec is the lightweight alternative to writing a bespoke file watcher into each project. It can sit beside `make`, `just`, `systemfd`, cargo tools, static site generators, test runners, and local servers, providing the missing event loop while letting the existing command remain the source of truth.

### 为什么软件包爱好者会关心

watchexec matters to package nerds because it packages the hard part of cross-platform file watching into a small, reusable Rust tool with first-party binaries, distro packages, and library crates. It also reflects a modern CLI pattern: one executable for everyday use, but a crate ecosystem underneath for downstream tools that need event filtering, process supervision, and shell-independent process control.

### 时间线

- 2016-09-18: GitHub repository created.
- 2016-11-23: Early 1.5.0 GitHub release published.
- 2020s: Project grows into a multi-crate ecosystem around the CLI and reusable watcher components.
- 2026-03-30: Citation metadata and releases identify CLI v2.5.1.
- 2026: Upstream package list documents first-party binaries plus Linux, macOS, Windows, Cargo, and Binstall distribution paths.

### Related projects

- Related tools include entr, Watchman, cargo-watch, notify-rs, just, systemfd, checkexec, ghciwatch, and language-specific development servers. watchexec's role is the general-purpose command rerunner rather than the source-control-aware service role played by Watchman.

### 来源

- <https://api.github.com/repos/watchexec/watchexec>
- <https://github.com/watchexec/watchexec>
- <https://raw.githubusercontent.com/watchexec/watchexec/main/CITATION.cff>
- <https://raw.githubusercontent.com/watchexec/watchexec/main/README.md>
- <https://raw.githubusercontent.com/watchexec/watchexec/main/crates/cli/README.md>
- <https://raw.githubusercontent.com/watchexec/watchexec/main/doc/packages.md>


## 安全说明

narrow executable package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- narrow executable package without higher-risk signals

## 其他软件包管理器记录

- Nix - watchexec: normalized package name match | nixpkgs package indexes: pkgs/by-name/wa/watchexec/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- apk - watchexec - 2.5.1-r0: normalized package name match | Alpine Linux edge package indexes: watchexec from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Executes commands in response to file modifications | https://github.com/watchexec/watchexec
- apk - watchexec-bash-completion - 2.5.1-r0: normalized package name match | Alpine Linux edge package indexes: watchexec-bash-completion from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Bash completions for watchexec | https://github.com/watchexec/watchexec
- apk - watchexec-doc - 2.5.1-r0: normalized package name match | Alpine Linux edge package indexes: watchexec-doc from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Executes commands in response to file modifications (documentation) | https://github.com/watchexec/watchexec
- apk - watchexec-fish-completion - 2.5.1-r0: normalized package name match | Alpine Linux edge package indexes: watchexec-fish-completion from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Fish completions for watchexec | https://github.com/watchexec/watchexec
- apk - watchexec-zsh-completion - 2.5.1-r0: normalized package name match | Alpine Linux edge package indexes: watchexec-zsh-completion from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Zsh completions for watchexec | https://github.com/watchexec/watchexec
- pacman - watchexec - 2.5.1-2: normalized package name match | Arch Linux sync databases: watchexec from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | Executes commands in response to file modifications | https://github.com/watchexec/watchexec
- zypper - watchexec - 2.5.1-1.3: normalized package name match | openSUSE Tumbleweed package metadata: watchexec from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Watches a path and runs a command whenever it detects modifications. | https://github.com/watchexec/watchexec
- MacPorts - watchexec: normalized package name match | MacPorts ports tree: sysutils/watchexec/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- Scoop - main/watchexec: normalized package name match | Scoop official bucket manifest trees: bucket/watchexec.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1


## Combined YAML source

View the package source record on GitHub. [combined/watchexec.yml](https://github.com/mxcl/pkgdb/blob/main/combined/watchexec.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
