# 使用 Homebrew, apk, MacPorts, Nix, winget 安装 flock

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

## 安装

```sh
sudo av install brew:flock
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install flock
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install flock
```

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

### Linux

- apk (92%):

```sh
sudo apk add flock
```

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

- Nix (92%):

```sh
nix profile install nixpkgs#flock
```

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

### Windows

- winget (92%):

```sh
winget install --id FlockFZ.Flock -e
```

  证据: Windows Package Manager source index: FlockFZ.Flock from https://cdn.winget.microsoft.com/cache/source.msix

## 软件包事实

- **软件包键:** brew:flock
- **软件包管理器:** Homebrew
- **软件包管理器页面:** <https://formulae.brew.sh/formula/flock>
- **版本:** 0.4.0
- **来源摘要:** Lock file during command
- **主页:** <https://github.com/discoteq/flock>
- **仓库:** <https://github.com/discoteq/flock>
- **上游文档:** <https://github.com/discoteq/flock#readme>
- **许可证:** ISC
- **源码归档:** <https://github.com/discoteq/flock/releases/download/v0.4.0/flock-0.4.0.tar.xz>
- **已生成:** 2026-07-08T18:08:21+00:00

## 可执行文件

- flock (cli)
- flock (别名)

## 安装行为

- post-install 钩子: 未定义
- Bottle: 可用 于 arm64_big_sur, arm64_linux, arm64_monterey, arm64_sequoia, arm64_sonoma, arm64_tahoe, arm64_ventura, big_sur, catalina, monterey, sonoma, ventura

## 版本和新鲜度

- 页面生成时间: 2026-07-08
- 管理器版本: 0.4.0
- 本地数据: OK
- 上游仓库: https://github.com/discoteq/flock
- 信息: No package-manager update timestamp was available.
- 信息: No cached GitHub release or tag data was available.
## 项目历史与用法

discoteq flock(1) is a portable command-line implementation of the Unix file-locking utility. It exists for systems where the util-linux flock(1) command is absent, inconvenient, or not portable enough.

### 项目历史

The project README explicitly frames the package as an answer to the question of why another flock(1) exists when util-linux already includes one. Its distinguishing goals are support across Linux, Illumos, Darwin, and FreeBSD, testing of major behavior and edge cases, an ISC license, and public source and issue tracking.

The GitHub release history dates the public package line at least to v0.1.1 in 2014, with later v0.2.x releases in 2014 and 2015 and a v0.4.0 release in 2020.

### 采用历史

The package is especially relevant on macOS and other non-Linux Unix-like systems because the README gives Homebrew and MacPorts installation paths. The supplied package facts also list Alpine, Nix, and other package-manager entries.

Its adoption pattern is practical rather than framework-driven: shell scripts, cron jobs, backups, and deploy tasks use flock to serialize work with a lock file.

### 使用方式

The common usage is to run flock with a lock-file path followed by a command, such as protecting an echo or rsync invocation so only one instance proceeds at a time.

Because it is a small system utility, its value is in predictable process coordination from shell scripts without embedding lock handling into each script.

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

For package maintainers, discoteq flock is a good example of packaging a small compatibility utility to make Unix scripts more portable across distributions and operating systems.

It matters in package-manager culture because the command name overlaps with a util-linux tool: correct formula naming, conflict handling, and platform behavior are the interesting parts, not a large dependency graph.

### 时间线

- 2014: Public GitHub releases include v0.1.1 and v0.2.0.
- 2015: The v0.2.x release series continues.
- 2020: v0.4.0 is released with source tarball installation instructions referenced by the README.

### Related projects

- util-linux provides the well-known Linux flock(1) implementation that this project compares itself with.
- bats-core is used by the project test suite.

### 来源

- <https://github.com/discoteq/flock>
- <https://github.com/discoteq/flock/releases>


## 安全说明

没有找到 flock 的匹配本地密钥处理 manifest。Nucleus 软件包元数据仍在此发布，以便未来覆盖拥有稳定的软件包 URL。


## 源数据库详情

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** flock
- **Version Scheme:** 0
- **Revision:** 0
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** stable

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

- Nix - flock: normalized package name match | nixpkgs package indexes: pkgs/by-name/fl/flock/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- apk - flock - 2.42-r0: normalized package name match | Alpine Linux edge package indexes: flock from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | File locker from util-linux | https://git.kernel.org/cgit/utils/util-linux/util-linux.git
- MacPorts - flock: normalized package name match | MacPorts ports tree: sysutils/flock/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- winget - FlockFZ.Flock: normalized package name match | Windows Package Manager source index: FlockFZ.Flock from https://cdn.winget.microsoft.com/cache/source.msix


## 相关链接

- [Source-control packages](https://www.automicvault.com/zh-hans/pkg/source-control-tools/) - Belongs to a source-control command family.
- [Terminal utility packages](https://www.automicvault.com/zh-hans/pkg/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Networking and protocol packages](https://www.automicvault.com/zh-hans/pkg/networking-protocol-tools/) - Matched network, protocol, or remote-service metadata.
- [Homebrew utility packages](https://www.automicvault.com/zh-hans/pkg/brew-utility-packages/) - Matched curated package taxonomy and local package facts.
- [gascity](https://www.automicvault.com/zh-hans/pkg/brew/gascity/) - Popular package that depends on this formula.
- [adr-tools](https://www.automicvault.com/zh-hans/pkg/brew/adr-tools/) - Local package facts share a topical domain. Shared terms: file.
- [afuse](https://www.automicvault.com/zh-hans/pkg/brew/afuse/) - Local package facts share a topical domain. Shared terms: file.
- [age](https://www.automicvault.com/zh-hans/pkg/brew/age/) - Local package facts share a topical domain. Shared terms: file.

## Combined YAML source

View the package source record on GitHub. [combined/flock.yml](https://github.com/automic-vault/db/blob/main/combined/flock.yml)


## 来源

- Nucleus package database
- package-page enrichment
- curated package history
- package version freshness
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
