# Install keep-sorted with Homebrew, Nix

Language-agnostic formatter that sorts selected lines. Version 0.9.1 via Homebrew; verified 2026-06-30.

## Install

```sh
sudo av install brew:keep-sorted
```

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install keep-sorted
```

  Evidence: local Homebrew formula metadata

### Linux

- Nix (92%):

```sh
nix profile install nixpkgs#keep-sorted
```

  Evidence: nixpkgs package indexes: pkgs/by-name/ke/keep-sorted/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

## Package facts

- **Package key:** brew:keep-sorted
- **Package manager:** Homebrew
- **Package manager page:** <https://formulae.brew.sh/formula/keep-sorted>
- **Version:** 0.9.1
- **Source summary:** Language-agnostic formatter that sorts selected lines
- **Homepage:** <https://github.com/google/keep-sorted>
- **Repository:** <https://github.com/google/keep-sorted>
- **Upstream docs:** <https://github.com/google/keep-sorted#readme>
- **License:** Apache-2.0
- **Source archive:** <https://github.com/google/keep-sorted.git>
- **Last updated:** 2026-06-30T18:46:01Z
- **Generated:** 2026-07-08T18:08:21+00:00

## Executables

- keep-sorted (cli)
- keep-sorted (alias)

## Build dependencies

- go

## Install behavior

- Post-install hook: not defined
- Bottle: available on arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sonoma, x86_64_linux

## Freshness

- Page generated: 2026-07-08
- Package-manager version: 0.9.1
- Package-manager updated: 2026-06-30
- Local data: ok
- Upstream repository: https://github.com/google/keep-sorted
- info: No cached GitHub release or tag data was available.
## Project history and usage

keep-sorted is Google's language-agnostic formatter for sorting marked blocks of lines inside larger files. Instead of trying to parse a whole language, it asks maintainers to mark regions with `keep-sorted start` and `keep-sorted end`, then sorts just those regions.

### Project history

The GitHub repository was created on 2023-02-23. The README presents the tool as a general formatter for sorted blocks and documents installation through `go install` and pre-commit integration. Public GitHub releases began with the 0.1.x line in January 2024, followed by rapid feature growth around nested blocks, numeric sorting, YAML-style option lists, regex sorting, release binaries, and skip/group options.

### Adoption history

Adoption is strongest in repositories that want deterministic ordering for generated-looking lists without adopting a language-specific formatter. The pre-commit hook documented in the README is the main adoption path: projects can enforce sorted blocks in review and CI while keeping the tool independent of file type.

### How it is used

Users wrap a section of code, configuration, documentation, or data with keep-sorted markers and run `keep-sorted` over files or stdin. Options on the marker control grouping, block parsing, case sensitivity, duplicate removal, descending order, regex-based sorting, and blank-line handling.

### Why package nerds care

keep-sorted is package-nerdy because it solves a recurring maintenance itch with a tiny explicit contract: the source file says which lines are machine-sortable. That makes it a useful complement to gofmt-style whole-file formatters and to pre-commit-driven hygiene stacks.

### Timeline

- 2023-02-23: GitHub repository created.
- 2024-01-23: v0.1.1, v0.2.0, and v0.3.0 releases published.
- 2024-03-05: v0.4.0 added skip_lines and group_prefixes options.
- 2024-09-27: v0.5.0 added YAML-list support for multi-valued options.
- 2025-03-18: v0.6.0 added by_regex and a --version flag.
- 2026-06-30: v0.9.1 published.

### Related projects

- keep-sorted is related to pre-commit, Go module distribution, repository-formatting tools, and language-specific formatters such as gofmt and clang-format, but it intentionally stays language-agnostic.

### Sources

- <https://api.github.com/repos/google/keep-sorted>
- <https://github.com/google/keep-sorted>
- <https://github.com/google/keep-sorted/releases>


## Security Notes

narrow executable package without higher-risk signals.

- **Geiger risk:** green / low
- narrow executable package without higher-risk signals

## Source Database Details

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

## Other Package-Manager Records

- Nix - keep-sorted: normalized package name match | nixpkgs package indexes: pkgs/by-name/ke/keep-sorted/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1


## 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.
- [Text processing packages](https://www.automicvault.com/pkg/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [Developer build packages](https://www.automicvault.com/pkg/developer-build-tools/) - Matched build, compiler, generator, or developer workflow metadata.
- [go](https://www.automicvault.com/pkg/brew/go/) - Build dependency declared by Homebrew.
- [bcpp](https://www.automicvault.com/pkg/brew/bcpp/) - Shares av.db curated category or tags: cli, developer-tools, formatter, formatting.
- [golines](https://www.automicvault.com/pkg/brew/golines/) - Shares av.db curated category or tags: cli, developer-tools, formatter, formatting.
- [sqlfmt](https://www.automicvault.com/pkg/brew/sqlfmt/) - Shares av.db curated category or tags: cli, developer-tools, formatter, formatting.
- [tex-fmt](https://www.automicvault.com/pkg/brew/tex-fmt/) - Shares av.db curated category or tags: cli, developer-tools, formatter, formatting.
- [treefmt](https://www.automicvault.com/pkg/brew/treefmt/) - Shares av.db curated category or tags: cli, developer-tools, formatter, formatting.
- [black](https://www.automicvault.com/pkg/brew/black/) - Shares av.db curated category or tags: cli, developer-tools, formatter, pre-commit.
- [djhtml](https://www.automicvault.com/pkg/brew/djhtml/) - Shares av.db curated category or tags: cli, developer-tools, formatter, pre-commit.
- [gersemi](https://www.automicvault.com/pkg/brew/gersemi/) - Shares av.db curated category or tags: cli, developer-tools, formatter, pre-commit.

## Combined YAML source

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


## Sources

- Nucleus package database
- Geiger risk classifier
- package-page enrichment
- curated package history
- package version freshness
- av.db category and tag curation
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
