# Install tfenv with Homebrew, MacPorts, Nix, chocolatey, pacman, scoop, winget

Terraform version manager inspired by rbenv. Version 3.2.2 via Homebrew; verified 2026-04-28.

## Install

```sh
sudo av install brew:tfenv
```

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install tfenv
```

  Evidence: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install tfenv
```

  Evidence: MacPorts ports tree: sysutils/tfenv/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- Nix (92%):

```sh
nix profile install nixpkgs#tfenv
```

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

- pacman (92%):

```sh
sudo pacman -S terraform
```

  Evidence: Arch Linux sync databases: terraform from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

### Windows

- Chocolatey (92%):

```sh
choco install terraform
```

  Evidence: Chocolatey community package catalog: terraform from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','telegram.install'

- Scoop (92%):

```sh
scoop install main/terraform
```

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

- winget (92%):

```sh
winget install --id Hashicorp.Terraform -e
```

  Evidence: Windows Package Manager source index: Hashicorp.Terraform from https://cdn.winget.microsoft.com/cache/source.msix

## Package facts

- **Package key:** brew:tfenv
- **Package manager:** Homebrew
- **Package manager page:** <https://formulae.brew.sh/formula/tfenv>
- **Version:** 3.2.2
- **Source summary:** Terraform version manager inspired by rbenv
- **Homepage:** <https://github.com/tfutils/tfenv>
- **Repository:** <https://github.com/tfutils/tfenv>
- **Upstream docs:** <https://github.com/tfutils/tfenv>
- **License:** MIT
- **Source archive:** <https://github.com/tfutils/tfenv/archive/refs/tags/v3.2.2.tar.gz>
- **Last updated:** 2026-04-28T22:04:46Z
- **Generated:** 2026-07-09T07:20:21+00:00

## Executables

- terraform (cli)
- tfenv (cli)
- terraform (alias)
- tfenv (alias)

## Dependencies

- grep

## Uses from macOS

- unzip

## Install behavior

- Post-install hook: not defined
- Bottle: available on all

## Freshness

- Page generated: 2026-07-09
- Package-manager version: 3.2.2
- Package-manager updated: 2026-04-28
- Local data: ok
- Upstream repository: https://github.com/tfutils/tfenv
- Upstream latest detected: v3.2.2 (current)
## Project history and usage

tfenv is a Terraform version manager modeled after `rbenv`. It installs Terraform versions, switches the active version, and lets projects pin versions with `.terraform-version` files.

### Project history

The README presents tfenv as a Terraform version manager inspired by rbenv, with a shell-script installation model: clone the repository into `~/.tfenv`, add its `bin` directory to PATH, or install it through Homebrew or other package managers.

Its history follows Terraform's own growth as teams moved from one global Terraform binary to many project-specific versions. tfenv added project version files, automatic installation, `latest` and regex-like selectors, minimum-required and latest-allowed resolution, checksum/signature verification paths, custom remotes, and private mirror support.

The release history shows long maintenance rather than a one-off wrapper. The v2.2.0 notes in 2021 included CI migration to GitHub Actions and macOS/Homebrew grep handling. v3.0.0 in 2022 was described as a major update with bashlog refactoring, Mac fixes, auto-install/use fixes, and netrc/private mirror support. v3.1.0 in 2026 was the first release since v3.0.0 and added more constraint handling, locks, custom remote compatibility, and broader tests.

### Adoption history

tfenv is one of the more visible Terraform helper tools in package-manager culture: the repository shows thousands of GitHub stars, Homebrew packages it directly, and the input metadata also records MacPorts and Nix packages. Its name and workflow match the pattern used by language/runtime version managers such as rbenv and pyenv.

Adoption is driven by team reproducibility. A repository can include `.terraform-version`, and developers or CI jobs that use tfenv get the intended Terraform version instead of relying on a manually managed global binary.

### How it is used

Common commands include `tfenv install`, `tfenv use`, `tfenv uninstall`, `tfenv list`, and `tfenv list-remote`. If no explicit version is passed, `tfenv install` and `tfenv use` resolve from `TFENV_TERRAFORM_VERSION`, `.terraform-version`, or defaults such as `latest`.

The `TFENV_NETRC_PATH` setting supports credentials for custom remotes, and `TFENV_REMOTE` lets users install Terraform from mirrors such as internal artifact repositories rather than HashiCorp's default release host.

### Why package nerds care

tfenv matters because it makes Terraform behave like a language runtime in a polyversion codebase. Package managers install tfenv once; tfenv then mediates the actual Terraform binaries needed by individual repositories.

For infrastructure engineers, this avoids a class of subtle plan/apply drift caused by the wrong Terraform CLI version. For package catalogs, it is a canonical example of a version-manager formula rather than a Terraform distribution itself.

### Timeline

- 2021: v2.2.0 release notes mention GitHub Actions migration and Homebrew-related macOS grep handling.
- 2022: v3.0.0 major update adds Mac, auto-install/use, netrc, and private mirror improvements.
- 2026: v3.1.0 is described as the first release since v3.0.0, with constraint, locking, and testing improvements.
- 2026: v3.2.2 is listed as the latest release on the official releases page.

### Related projects

- `rbenv` is the version-manager pattern explicitly cited by tfenv.
- Terraform is the binary managed by tfenv.
- HashiCorp release servers and private mirrors are the remote sources tfenv installs from.

### Sources

- <https://github.com/tfutils/tfenv>
- <https://github.com/tfutils/tfenv/releases>
- source_facts.package-manager


## Security Notes

infrastructure mutation or orchestration signal.

- **Geiger risk:** orange / medium
- infrastructure mutation or orchestration signal


## 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: .terraform-version, ~/.terraform-version

## Credential files

- Unix: $TFENV_NETRC_PATH
## Source Database Details

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** tfenv
- **Version Scheme:** 0
- **Revision:** 0
- **Head Version:** HEAD
- **Conflicts With:** tenv
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** head, stable

## Other Package-Manager Records

- Nix - tfenv: normalized package name match | nixpkgs package indexes: pkgs/by-name/tf/tfenv/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- MacPorts - tfenv: normalized package name match | MacPorts ports tree: sysutils/tfenv/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- MacPorts - terraform: installed executable or alias match | MacPorts ports tree: sysutils/terraform/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- Nix - terraform: installed executable or alias match | nixpkgs package indexes: terraform from https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/all-packages.nix
- pacman - terraform - 1.15.6-1: installed executable or alias match | Arch Linux sync databases: terraform from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | HashiCorp tool for building and updating infrastructure as code idempotently | https://github.com/hashicorp/terraform
- Chocolatey - terraform: installed executable or alias match | Chocolatey community package catalog: terraform from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','telegram.install'
- Scoop - main/terraform: installed executable or alias match | Scoop official bucket manifest trees: bucket/terraform.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1
- winget - Hashicorp.Terraform: installed executable or alias match | Windows Package Manager source index: Hashicorp.Terraform from https://cdn.winget.microsoft.com/cache/source.msix
- winget - Hashicorp.Terraform.Alpha: installed executable or alias match | Windows Package Manager source index: Hashicorp.Terraform.Alpha from https://cdn.winget.microsoft.com/cache/source.msix
- winget - Hashicorp.Terraform.Beta: installed executable or alias match | Windows Package Manager source index: Hashicorp.Terraform.Beta from https://cdn.winget.microsoft.com/cache/source.msix
- winget - Hashicorp.Terraform.RC: installed executable or alias match | Windows Package Manager source index: Hashicorp.Terraform.RC from https://cdn.winget.microsoft.com/cache/source.msix


## Related links

- [Cloud CLI packages](https://www.automicvault.com/pkg/cloud-clis/) - Belongs to a cloud or infrastructure command family.
- [Source-control packages](https://www.automicvault.com/pkg/source-control-tools/) - Belongs to a source-control command family.
- [Secret-risk packages](https://www.automicvault.com/pkg/secret-risk-packages/) - Has protected-tool coverage, approval-gate, or non-low Geiger security signals.
- [Terminal utility packages](https://www.automicvault.com/pkg/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [grep](https://www.automicvault.com/pkg/brew/grep/) - Runtime dependency declared by Homebrew.
- [tenv](https://www.automicvault.com/pkg/brew/tenv/) - Shares av.db curated category or tags: cli, developer-tools, terraform, version-management, version-manager.
- [tfmcp](https://www.automicvault.com/pkg/brew/tfmcp/) - Shares av.db curated category or tags: cli, developer-tools, infrastructure, infrastructure-as-code, terraform.
- [tfmigrate](https://www.automicvault.com/pkg/brew/tfmigrate/) - Shares av.db curated category or tags: cli, developer-tools, infrastructure, infrastructure-as-code, terraform.
- [tfmv](https://www.automicvault.com/pkg/brew/tfmv/) - Shares av.db curated category or tags: cli, developer-tools, infrastructure, infrastructure-as-code, terraform.
- [tfocus](https://www.automicvault.com/pkg/brew/tfocus/) - Shares av.db curated category or tags: cli, developer-tools, infrastructure, infrastructure-as-code, terraform.
- [tfplugingen-openapi](https://www.automicvault.com/pkg/brew/tfplugingen-openapi/) - Shares av.db curated category or tags: cli, developer-tools, infrastructure, infrastructure-as-code, terraform.
- [tfproviderlint](https://www.automicvault.com/pkg/brew/tfproviderlint/) - Shares av.db curated category or tags: cli, developer-tools, infrastructure, infrastructure-as-code, terraform.
- [tgenv](https://www.automicvault.com/pkg/brew/tgenv/) - Shares av.db curated category or tags: cli, developer-tools, infrastructure-as-code, version-management, version-manager.
- [tfupdate](https://www.automicvault.com/pkg/brew/tfupdate/) - Local package facts share a topical domain. Shared terms: cli, code, developer, developer-tools, infrastructure.
- [fnm](https://www.automicvault.com/pkg/brew/fnm/) - Local package facts share a topical domain. Shared terms: cli, developer, developer-tools, management, manager.

## Combined YAML source

View the package source record on GitHub. [combined/tfenv.yml](https://github.com/automic-vault/db/blob/main/combined/tfenv.yml)


## Sources

- Nucleus package database
- Geiger risk classifier
- package-page enrichment
- curated configuration and credential file locations
- curated package history
- package version freshness
- av.db category and tag curation
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
