Installing OpenTofu & the tofu CLI

A drop-in for the terraform command.

Beginner10 min · lesson 2 of 12

OpenTofu ships a single static binary called tofu, and the CLI is a deliberate mirror of terraform — same subcommands, same flags, same output. If you know terraform init / plan / apply, you already know tofu. Install it from the OpenTofu releases, a package manager, or the official install script; on CI, pin the version like any other tool.

terminal
# install (one option — see opentofu.org for your platform)
$ brew install opentofu
$ tofu version
OpenTofu v1.8.2
on darwin_arm64
$ tofu -help | head -6 # the same subcommands as terraform
Usage: tofu [global options] <subcommand> [args]
init Prepare your working directory for other commands
plan Show changes required by the current configuration
apply Create or update infrastructure

Drop-in usage

Point tofu at an existing Terraform directory and it just works: it reads the same .tf files, downloads the same providers, and uses the same .terraform working directory conventions. Many teams alias terraform=tofu during a transition so muscle memory and scripts keep working while they switch.

terminal
$ cd my-terraform-project
$ tofu init # reads the same .tf, downloads the same providers
$ tofu plan # identical plan output to terraform
$ tofu apply
Pin the version in CI
tofu and terraform version their state and features, so let CI choose the tool version explicitly (a setup-opentofu action, or a pinned install) rather than “whatever is on the runner.” Mixing a newer tofu with an older one against shared state can upgrade the state format and lock out the older tool — pin both the tool and, later, the required_version in config.