# Install tfsort with Homebrew, Nix

CLI to sort Terraform variables and outputs. Version 0.7.1 via Homebrew; verified 2026-07-26. Also installable with nix: nix profile install nixpkgs#tfsort.

## Install

```sh
sudo av install brew:tfsort
```

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install tfsort
```

  Evidence: local Homebrew formula metadata

### Linux

- Nix (92%):

```sh
nix profile install nixpkgs#tfsort
```

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

## Package facts

- **Package key:** brew:tfsort
- **Package manager:** Homebrew
- **Version:** 0.7.1
- **Source summary:** CLI to sort Terraform variables and outputs
- **Homepage:** <https://github.com/AlexNabokikh/tfsort>
- **Repository:** <https://github.com/AlexNabokikh/tfsort>
- **Last updated:** 2026-07-26T00:50:39+02:00
- **Generated:** 2026-08-03T19:37:03+00:00

## Executables

- tfsort (alias)

## Install behavior

- Bottle: not available

## Freshness

- Page generated: 2026-08-03
- Package-manager version: 0.7.1
## Project history and usage

tfsort is a small Terraform/HCL formatting utility. Its README describes a CLI for alphabetically sorting Terraform `variable`, `output`, `locals`, and `terraform` blocks, while also cleaning spacing and leading or trailing newlines.

### Project history

The project was created by Alexander Nabokikh and is distributed as a Go-based command-line tool. Its release page shows continuing releases through v0.7.1 in July 2025.

### Adoption history

The README documents installation through Homebrew, Nix, Chocolatey, Go install, binary releases, and source builds. The input metadata records Homebrew and Nix packaging.

### How it is used

The package-nerd use case is local cleanup of Terraform repositories: run `tfsort` on a file, feed it stdin, or process a directory recursively. The README documents dry-run mode and recursive processing while skipping `.git`, `.terraform`, and `.terragrunt-cache`.

### Why package nerds care

tfsort sits in the small-tool layer around Terraform: it does not replace `terraform fmt`, but gives users a packageable CLI for opinionated ordering of common HCL blocks in `.tf`, `.hcl`, and `.tofu` files.

### Timeline

- 2023-02-24: The GitHub releases page lists tfsort v0.2.1.
- 2025-07-14: The GitHub releases page lists tfsort v0.7.1.
- 2026: The input metadata records tfsort in Homebrew and Nix.

### Related projects

- tfsort is adjacent to Terraform, OpenTofu, Terragrunt, and other HCL formatting or linting tools used before review and CI.

### Sources

- <https://github.com/AlexNabokikh/tfsort README>
- <https://github.com/AlexNabokikh/tfsort/releases>
- source_facts.package-manager


## Security Notes

narrow executable package without higher-risk signals.

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

## Other Package-Manager Records

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


## Combined YAML source

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


## Sources

- 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
