# 使用 Homebrew, MacPorts, Nix, pacman, scoop 安装 ktlint

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

## 安装

```sh
sudo av install brew:ktlint
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install ktlint
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install ktlint
```

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

### Linux

- Nix (92%):

```sh
nix profile install nixpkgs#ktlint
```

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

- pacman (92%):

```sh
sudo pacman -S ktlint
```

  证据: Arch Linux sync databases: ktlint from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

### Windows

- Scoop (92%):

```sh
scoop install main/ktlint
```

  证据: Scoop official bucket manifest trees: bucket/ktlint.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1

## 软件包事实

- **软件包键:** brew:ktlint
- **软件包管理器:** Homebrew
- **版本:** 1.8.0
- **来源摘要:** Anti-bikeshedding Kotlin linter with built-in formatter
- **主页:** <https://ktlint.github.io/>
- **仓库:** <https://github.com/ktlint/ktlint>
- **最后更新:** 2026-07-04T16:53:43+09:00
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- ktlint (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

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

ktlint is an anti-bikeshedding Kotlin linter with a built-in formatter. Its docs describe it as a Kotlin linter in the spirit of JavaScript Standard Style and gofmt: low setup, conventional defaults, and automatic formatting when possible.

### 项目历史

The documentation copyright trail records Stanley Shyiko's original 2016-2019 authorship and Pinterest's 2019 stewardship. The repository later moved from the pinterest namespace to the ktlint organization on GitHub, while the Homebrew package still records the historical pinterest/ktlint repository URL.

### 采用历史

ktlint gained adoption by combining a CLI jar, Maven/Gradle integrations, reporters, custom rule sets, .editorconfig support, and package-manager distribution. Its docs emphasize no-configuration defaults, Kotlin coding conventions, Android Kotlin Style Guide alignment, and extensibility for organizations that need custom checks.

### 使用方式

Users run ktlint to scan .kt and .kts files, optionally with --format or -F to autocorrect violations. Teams commonly add it to build pipelines, pre-commit hooks, editor workflows, or Gradle/Maven tasks, with .editorconfig and baseline files used when defaults need project-level adjustment.

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

ktlint is significant because it became the Kotlin ecosystem's canonical packaged linter/formatter pair: one executable jar, common default rules, multiple reporters, custom rulesets, and enough integration points to make style enforcement portable across editors, CI, and package managers.

### 时间线

- 2016: The docs copyright trail begins Stanley Shyiko's authorship period.
- 2019: Pinterest stewardship appears in the docs copyright trail.
- 2024-12-04: Tag 1.5.0 was published in the GitHub tag history.
- 2025-11-14: Release 1.8.0 was published on GitHub.

### Related projects

- Related projects include Kotlin coding conventions, Android Kotlin Style Guide, gofmt, JavaScript Standard Style, ktfmt, Gradle, Maven, and .editorconfig.

### 来源

- <https://github.com/ktlint/ktlint>
- <https://github.com/ktlint/ktlint/releases>
- <https://github.com/pinterest/ktlint/tags>
- <https://pinterest.github.io/ktlint/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: .editorconfig, ktlint-baseline.xml
## 其他软件包管理器记录

- Nix - ktlint: normalized package name match | nixpkgs package indexes: pkgs/by-name/kt/ktlint/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- pacman - ktlint - 1.8.0-1: normalized package name match | Arch Linux sync databases: ktlint from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | An anti-bikeshedding Kotlin linter with built-in formatter | https://ktlint.github.io/
- MacPorts - ktlint: normalized package name match | MacPorts ports tree: devel/ktlint/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- Scoop - main/ktlint: normalized package name match | Scoop official bucket manifest trees: bucket/ktlint.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1


## Combined YAML source

View the package source record on GitHub. [combined/ktlint.yml](https://github.com/mxcl/pkgdb/blob/main/combined/ktlint.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
