TerraformPilot

OpenTofu

How to Install OpenTofu on macOS, Linux, and Windows

Step-by-step guide to install OpenTofu on macOS (Homebrew), Linux (apt, dnf, rpm), and Windows (Chocolatey, Scoop). Includes verification, version pinning...

LLuca Berton2 min read

OpenTofu is the open-source, MPL-2.0-licensed fork of Terraform maintained by the Linux Foundation. It ships as a single static binary called tofu. This guide walks through installing it on macOS, Linux, and Windows — including how to run it side-by-side with the HashiCorp terraform binary.

Prerequisites

#
  • A 64-bit operating system (macOS 12+, modern Linux, Windows 10+).
  • Administrator/sudo access to install system packages.
  • (Optional) An existing Terraform project to test against — see How to Migrate from Terraform to OpenTofu.

macOS — Homebrew

#

Homebrew has the official tap maintained by the OpenTofu project.

brew update
brew install opentofu
tofu version

Expected output:

OpenTofu v1.9.0
on darwin_arm64

To upgrade later: brew upgrade opentofu.

Linux — Debian / Ubuntu (apt)

#

Use the standalone installer script published by the project — it handles GPG keys and the apt source automatically:

curl --proto '=https' --tlsv1.2 -fsSL \
  https://get.opentofu.org/install-opentofu.sh -o install-opentofu.sh
chmod +x install-opentofu.sh
./install-opentofu.sh --install-method deb
tofu version

To upgrade: sudo apt update && sudo apt upgrade tofu.

Linux — RHEL / Fedora / Rocky / AlmaLinux (dnf)

#
curl --proto '=https' --tlsv1.2 -fsSL \
  https://get.opentofu.org/install-opentofu.sh -o install-opentofu.sh
chmod +x install-opentofu.sh
./install-opentofu.sh --install-method rpm
tofu version

Linux — Manual binary install (any distro)

#

If you prefer not to add a system repository, download the static binary:

TOFU_VERSION=1.9.0
curl -fsSL -o tofu.tar.gz \
  "https://github.com/opentofu/opentofu/releases/download/v${TOFU_VERSION}/tofu_${TOFU_VERSION}_linux_amd64.tar.gz"
sudo tar -C /usr/local/bin -xzf tofu.tar.gz tofu
sudo chmod +x /usr/local/bin/tofu
rm tofu.tar.gz
tofu version

Windows — Chocolatey

#
choco install opentofu
tofu version

Or with Scoop:

scoop bucket add main
scoop install opentofu

Side-by-side with Terraform

#

Because the binary is named tofu (not terraform), you can run both on the same machine without conflicts. Most projects work unmodified:

# Convert an existing Terraform project to OpenTofu
cd my-terraform-project
tofu init
tofu plan

State files are interchangeable in both directions for projects that don't use Terraform 1.6+ exclusive features. See Terraform vs OpenTofu: Key Differences for the compatibility matrix.

Pinning a specific version with tofuenv

#

For multi-project work, install tofuenv (a fork of tfenv) to switch versions on demand:

git clone https://github.com/tofuutils/tofuenv.git ~/.tofuenv
echo 'export PATH="$HOME/.tofuenv/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
tofuenv install 1.9.0
tofuenv use 1.9.0

Add a .opentofu-version file in your project to pin per-repository.

Verifying the installation

#
tofu version
tofu providers
tofu -help

You should see the same subcommands you know from Terraform: init, plan, apply, destroy, state, import, workspace, fmt, validate.

Next steps

#

Conclusion

#

OpenTofu is a drop-in replacement for Terraform that takes minutes to install and produces a familiar tofu CLI. For most workflows it's a one-line change in your CI/CD pipelines (terraformtofu) and a tofu init away from running.

#OpenTofu#Terraform#Installation#macOS#Linux#Windows

Share this article