# 使用 Homebrew, chocolatey, MacPorts, Nix, scoop 安装 tfsec

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

## 安装

```sh
sudo av install brew:tfsec
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install tfsec
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install tfsec
```

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

### Linux

- Nix (92%):

```sh
nix profile install nixpkgs#tfsec
```

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

### Windows

- Chocolatey (92%):

```sh
choco install tfsec
```

  证据: Chocolatey community package catalog: tfsec from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','termius'

- Scoop (92%):

```sh
scoop install main/tfsec
```

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

## 软件包事实

- **软件包键:** brew:tfsec
- **软件包管理器:** Homebrew
- **版本:** 1.28.14
- **来源摘要:** Static analysis security scanner for your terraform code
- **主页:** <https://aquasecurity.github.io/tfsec/latest/>
- **仓库:** <https://github.com/aquasecurity/tfsec>
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- tfsec (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

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

tfsec is an Aqua Security command-line scanner for finding security misconfigurations in Terraform code. Its official README describes it as a static-analysis tool for Terraform and lists broad cloud-provider coverage, hundreds of built-in rules, multiple report formats, CI usage, Docker images, editor integrations, GitHub Actions, and Azure DevOps integration.

In 2023 Aqua announced that tfsec was joining the Trivy family. The project remained available, but Aqua directed users toward Trivy for ongoing engineering attention and a broader scanner ecosystem.

### 项目历史

The project grew around Terraform-specific static analysis: scanning local and remote modules, evaluating HCL expressions and Terraform functions, checking relationships between Terraform resources, supporting Terraform CDK, and allowing user-defined Rego policies.

Aqua's tfsec-to-Trivy migration material frames tfsec as one of the foundations of Trivy's infrastructure-as-code and misconfiguration scanning support. The migration guide maps common tfsec commands to Trivy equivalents, such as replacing `tfsec <dir>` with `trivy config <dir>`.

### 采用历史

The official README documents package-manager and binary distribution through Homebrew/Linuxbrew, Chocolatey, Scoop, Go install, release binaries, and Docker images. The input metadata also records Homebrew, Chocolatey, MacPorts, Nix, and Scoop packaging.

The README cites Thoughtworks Tech Radar's Adopt rating and describes tfsec as a default static-analysis tool for Terraform in Thoughtworks projects. Aqua's 2023 announcement shows the adoption inflection point: the Terraform scanning engine moved into the wider Trivy product and community path while tfsec stayed available.

### 使用方式

The usual package-nerd workflow was `brew install tfsec` followed by `tfsec .` in a Terraform repository. The tool exits non-zero when it finds problems, which made it natural for CI gates.

tfsec supported machine-readable output such as JSON, SARIF, CSV, Checkstyle, and JUnit, plus GitHub Security Alerts via SARIF upload. It also supported inline ignore comments such as `tfsec:ignore:<rule>`, expiry dates for ignores, tfvars input, custom checks under `.tfsec`, and a root `.tfsec/config.json` or `.tfsec/config.yml` config file.

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

For Homebrew and other package-manager users, tfsec was a compact example of an IaC security tool that could be installed as a single CLI and dropped into editors, hooks, and CI without a service dependency.

Its later migration into Trivy is significant for package catalogs because it marks a common lifecycle for niche security CLIs: first a focused Terraform scanner, then an engine folded into a broader multi-surface scanner while the old binary remains packaged for existing automation.

### 时间线

- 2023-02-18: Aqua announced that tfsec was joining the Trivy family and encouraged the community to transition to Trivy.
- 2024-2025: The GitHub releases page shows continuing tfsec maintenance releases in the v1.28 series, including v1.28.14 on 2025-05-02.
- 2026: The input metadata still records tfsec in multiple package managers, including Homebrew, Chocolatey, MacPorts, Nix, and Scoop.

### Related projects

- Trivy is the successor path recommended by Aqua for Terraform and broader misconfiguration scanning.
- The README links related tfsec integrations including tfsec-pr-commenter-action, tfsec-sarif-action, the official Azure DevOps task, and editor plugins for JetBrains, VS Code, and Vim.

### 来源

- <https://aquasecurity.github.io/tfsec/v0.63.1/getting-started/configuration/config/>
- <https://github.com/aquasecurity/tfsec README>
- <https://github.com/aquasecurity/tfsec/blob/master/tfsec-to-trivy-migration-guide.md>
- <https://github.com/aquasecurity/tfsec/discussions/1994>
- 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: .tfsec/config.json, .tfsec/config.yml
## 其他软件包管理器记录

- Nix - tfsec: normalized package name match | nixpkgs package indexes: pkgs/by-name/tf/tfsec/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- MacPorts - tfsec: normalized package name match | MacPorts ports tree: security/tfsec/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- Chocolatey - tfsec: normalized package name match | Chocolatey community package catalog: tfsec from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','termius'
- Scoop - main/tfsec: normalized package name match | Scoop official bucket manifest trees: bucket/tfsec.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/tfsec.yml](https://github.com/mxcl/pkgdb/blob/main/combined/tfsec.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
