# 使用 Homebrew, MacPorts, Nix 安装 treefmt

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

## 安装

```sh
sudo av install brew:treefmt
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install treefmt
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install treefmt
```

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

### Linux

- Nix (92%):

```sh
nix profile install nixpkgs#treefmt
```

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

## 软件包事实

- **软件包键:** brew:treefmt
- **软件包管理器:** Homebrew
- **版本:** 2.5.0
- **来源摘要:** One CLI to format the code tree
- **主页:** <https://treefmt.com/latest/>
- **仓库:** <https://github.com/numtide/treefmt>
- **最后更新:** 2026-07-26T00:51:27+02:00
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- treefmt (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

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

treefmt is a formatter multiplexer: one CLI that runs the right formatters across a source tree from a project-level configuration file.

### 项目历史

Numtide's README explains treefmt as a response to polyglot repositories, where each language brings its own formatter and teams repeatedly reimplement scripts to run them. treefmt turns that recurring script into one command.

The project emphasizes a unified CLI and output, parallel execution, and tracking changed files so that formatting does not always have to scan and rewrite an entire repository. Its documentation centers the `treefmt.toml` file in the project root as the place where formatter commands, options, and include globs are declared.

By 2026 the GitHub repository had multiple major releases, Go and Nix build metadata, and related tooling such as treefmt-nix, reflecting its adoption in Nix-heavy and polyglot development workflows.

### 采用历史

treefmt's adoption is closely tied to repositories that do not want language-specific formatting scripts in every project. It is packaged by Homebrew, MacPorts, and Nix, and the upstream README explicitly points Nix users at treefmt-nix.

For package users, the attraction is boring consistency: install one binary, commit one `treefmt.toml`, and let CI or pre-commit workflows run all configured formatters the same way.

### 使用方式

A project usually creates `treefmt.toml` with `treefmt --init`, defines formatter sections with command, options, and include globs, and then runs `treefmt` from the project root.

Package nerds use it to standardize formatting across Nix, Rust, Go, JavaScript, and other mixed-language repos without maintaining a custom shell script per repository.

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

treefmt is significant because it packages repository formatting as a composable CLI rather than a pile of local scripts. That matters to reproducible developer environments, especially where Nix flakes and CI expect declarative tooling.

### 时间线

- Project docs: treefmt is presented as the formatter multiplexer.
- 2026: v2.5.0 release adds formatter option support and Go toolchain updates.
- 2026: The repository records roughly a thousand stars, dozens of releases, and continued maintenance.

### Related projects

- treefmt-nix wraps treefmt for Nix-based configuration and formatter provisioning.
- Related tools named upstream include EditorConfig, Prettier, Super-Linter, and pre-commit.

### 来源

- <https://github.com/numtide/treefmt>
- <https://github.com/numtide/treefmt/releases>
- <https://treefmt.com/latest/>


## 安全说明

narrow executable package without higher-risk signals.

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


## Configuration and credential file locations

These source-backed paths show where this package keeps local settings or durable credentials. Automic Vault can use them as review targets for secret scanning, migration, and command approval.


## Configuration files

- Unix: treefmt.toml
## 其他软件包管理器记录

- Nix - treefmt: normalized package name match | nixpkgs package indexes: pkgs/by-name/tr/treefmt/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- MacPorts - treefmt: normalized package name match | MacPorts ports tree: devel/treefmt/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1


## Combined YAML source

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


## 来源

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