# 使用 Homebrew, dnf, MacPorts, Nix 安装 swiftlint

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

## 安装

```sh
sudo av install brew:swiftlint
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install swiftlint
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install swiftlint
```

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

### Linux

- dnf (92%):

```sh
sudo dnf install swiftlint
```

  证据: Fedora Rawhide package metadata: swiftlint from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst

- Nix (92%):

```sh
nix profile install nixpkgs#swiftlint
```

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

## 软件包事实

- **软件包键:** brew:swiftlint
- **软件包管理器:** Homebrew
- **版本:** 0.65.0
- **来源摘要:** Tool to enforce Swift style and conventions
- **主页:** <https://github.com/realm/SwiftLint>
- **仓库:** <https://github.com/realm/SwiftLint>
- **最后更新:** 2026-06-27T09:34:51Z
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- swiftlint (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

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

SwiftLint is a Swift style and convention linter originally published by Realm. It became one of the default package-manager-installed tools in Swift projects because it gives teams a shared command-line style gate for local development, Xcode, SwiftPM, Bazel, CocoaPods, Mint, and CI.

### 项目历史

The SwiftLint repository was created in May 2015. The README describes the tool as loosely based on the archived GitHub Swift Style Guide and aligned with rules generally accepted by the Swift community.

As Swift tooling matured, SwiftLint moved from simple command-line linting into several build-system surfaces. Its README now documents Swift Package command and build-tool plugins, Xcode package integration, Homebrew, CocoaPods, Mint, Bazel, prebuilt packages, and source builds.

### 采用历史

SwiftLint's adoption follows the rise of Swift as a production language: teams needed automated style checks that could run before code review and inside Xcode builds. The official README includes a 2017 video introduction by JP Simard, showing that the project had already become notable in the Swift community by then.

The input package facts show broad packaging beyond Homebrew, including DNF, MacPorts, and Nix. That cross-manager presence is unusual for a Swift-specific CLI and signals sustained use outside one local macOS setup.

### 使用方式

Common usage is `swiftlint` in a project directory, usually governed by `.swiftlint.yml`. The README emphasizes that SwiftLint analyzes valid, compilable Swift source, which is why teams often place it after or alongside normal build steps rather than as a substitute compiler.

Modern usage includes SwiftPM plugins and Bazel targets as well as traditional Homebrew-installed binaries called from Xcode script phases.

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

SwiftLint is package-nerd significant because it packages a moving style rule set as a reproducible CLI. Version pinning matters: rule defaults, SwiftSyntax behavior, and autocorrection can affect source diffs across a whole repository.

It also demonstrates how Swift command-line tools escaped the single-machine Homebrew model and became build plugins, package dependencies, and CI artifacts.

### 时间线

- 2015: GitHub repository created.
- 2017: Official README links a recorded video introduction.
- 2018: GitHub release metadata includes 0.28.x and 0.29.x releases.
- 2026: GitHub release metadata shows active 0.63.x through 0.65.x maintenance.

### Related projects

- Related projects include SwiftFormat for formatting, SwiftSyntax for rule implementation, SourceKit/Clang for type information, SwiftLintPlugins for SwiftPM plugin consumption, and Bazel rules for build integration.

### 来源

- <https://api.github.com/repos/realm/SwiftLint>
- <https://github.com/realm/SwiftLint#readme>
- <https://realm.github.io/SwiftLint>
- input.source_facts.package-manager


## 安全说明

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: .swiftlint.yml
## 其他软件包管理器记录

- Nix - swiftlint: normalized package name match | nixpkgs package indexes: pkgs/by-name/sw/swiftlint/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- dnf - swiftlint - 0.63.0-2.fc45: normalized package name match | Fedora Rawhide package metadata: swiftlint from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Tool to enforce Swift style and conventions | https://realm.github.io/SwiftLint/
- MacPorts - swiftlint: normalized package name match | MacPorts ports tree: devel/swiftlint/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1


## 相关链接

- [swiftlint](https://pkg.so/zh-hans/pkg/npm/swiftlint/) - Same normalized package name exists in another local package ecosystem.

## Combined YAML source

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