Free ยท Lesson 2 of 12

Install and version managers

Install one version on purpose. A version manager is how a directory can pick a different version without hiding which binary is first on PATH.

Sign in to save your place.

Picture it this way

Two rulers in the same pencil case will not measure the same if you grab the wrong one. terraform version is you reading the ruler before you cut.

Official packages and zip files

HashiCorp publishes Terraform packages and a zip you can unpack. OpenTofu publishes its own install instructions and binaries named tofu. Follow the page for the tool you chose. Do not rename tofu to terraform to satisfy an old script. You will forget which one you ran.

Homebrew, apt, and yum repositories exist for HashiCorp. A distribution package can lag. terraform version after install is the check, not the package manager's advertisement.

tfenv, asdf, and tofuenv

tfenv and the asdf Terraform plugin install HashiCorp Terraform versions. OpenTofu has its own install paths, including a tofuenv-style manager and asdf plugins. A manager that only knows Terraform will not install OpenTofu, and the reverse is not a promise either.

A .terraform-version file pins Terraform for tfenv in that directory. It does nothing for a teammate who does not use tfenv. Commit a note of the version next to the code, and still run terraform version in CI so the runner proves it.

Command Tells you
terraform version The HashiCorp binary on PATH, if that name exists
tofu version The OpenTofu binary on PATH
which terraform The path of the file you are about to run

Which binary

  1. PATH
  2. Binary
  3. Version

Step 1 of 3The shell runs the first matching name. A manager changes what that name points at.

Lab: print the version and stop

Run the command for the tool you installed. If the command is not found, that is a successful reading of this lesson. Install from the official page, then print the version again.

terraform version
# or, if you chose OpenTofu:
tofu version
which terraform || true
which tofu || true

Concept summary

Knowledge check

You need OpenTofu. Which command should print the version?

A directory contains .terraform-version but CI installed Terraform another way. What is true?

Why avoid renaming tofu to terraform?

Official sources

Checked against the linked documentation in October 2026. A later release can move a flag, a price, or a supported pair. Use the page for the version you installed.