# Install flock with Homebrew, apk, MacPorts, Nix, winget

Lock file during command. Version 0.4.0 via Homebrew; verified from local package data.

## Install

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

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install flock
```

  Evidence: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install flock
```

  Evidence: 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
```

  Evidence: 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
```

  Evidence: 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
```

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

## Package facts

- **Package key:** brew:flock
- **Package manager:** Homebrew
- **Package manager page:** <https://formulae.brew.sh/formula/flock>
- **Version:** 0.4.0
- **Source summary:** Lock file during command
- **Homepage:** <https://github.com/discoteq/flock>
- **Repository:** <https://github.com/discoteq/flock>
- **Upstream docs:** <https://github.com/discoteq/flock#readme>
- **License:** ISC
- **Source archive:** <https://github.com/discoteq/flock/releases/download/v0.4.0/flock-0.4.0.tar.xz>
- **Generated:** 2026-07-08T07:18:31+00:00

## Executables

- flock (cli)
- flock (alias)

## Install behavior

- Post-install hook: not defined
- Bottle: available on arm64_big_sur, arm64_linux, arm64_monterey, arm64_sequoia, arm64_sonoma, arm64_tahoe, arm64_ventura, big_sur, catalina, monterey, sonoma, ventura

## Freshness

- Page generated: 2026-07-08
- Package-manager version: 0.4.0
- Local data: ok
- Upstream repository: https://github.com/discoteq/flock
- info: No package-manager update timestamp was available.
- info: No cached GitHub release or tag data was available.
## Project history and usage

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.

### Project history

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.

### Adoption history

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.

### How it is used

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.

### Why package nerds care

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.

### Timeline

- 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.

### Sources

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


## Security Notes

No matching local secret-handling manifest was found for flock. Nucleus package metadata is still published here so future coverage has a stable package URL.


## Source Database Details

- **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

## Other Package-Manager Records

- 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


## Related links

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


## Sources

- 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
