TerraformPilot

Technology

How to Install Terraform (Quick Guide for Any OS)

Terraform install guide for Linux, macOS, Windows. Use apt, dnf, brew, or download binary. Step-by-step for Ubuntu, Debian, RHEL, Fedora, Arch.

LLuca Berton4 min read

To install Terraform, add HashiCorp's official package repository for your OS, then run apt install terraform, dnf install terraform, or brew install hashicorp/tap/terraform. This page is the hub for installing Terraform on any operating system — pick your platform from the directory below for a full step-by-step guide, or use the quick commands here to get running in under a minute.

Quick Install (TL;DR)

#

Terraform is distributed by HashiCorp through official package repositories and as a standalone binary. The fastest path depends on your OS:

# macOS (Homebrew)
brew tap hashicorp/tap && brew install hashicorp/tap/terraform
 
# Debian / Ubuntu (apt)
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install terraform
 
# RHEL / Fedora / Rocky / AlmaLinux (dnf)
sudo dnf install -y dnf-plugins-core
sudo dnf config-manager --add-repo https://rpm.releases.hashicorp.com/fedora/hashicorp.repo
sudo dnf install terraform

Then confirm the install:

terraform --version

You should see Terraform v1.12+ on linux_amd64, darwin_arm64, or your matching platform.

Which install method should I use?

#
  • Official package manager (recommended). Using HashiCorp's apt/dnf/brew repositories means apt upgrade, dnf upgrade, or brew upgrade keeps Terraform current alongside the rest of your system. Best for workstations and CI runners.
  • Version manager (tfenv). Teams that pin Terraform per project should use tfenv with a .terraform-version file so everyone runs the exact same version.
  • Manual binary. On distros without a HashiCorp repo (Alpine, Void, Gentoo, Slackware, NixOS), download the official zip, verify the checksum, and drop the binary in /usr/local/bin. Each guide below shows the exact steps.
  • Docker. For ephemeral or sandboxed runs, the Docker image avoids touching the host at all.

Verify your installation

#

After installing on any platform, run a quick smoke test:

terraform -help        # confirms the binary is on your PATH
terraform version      # prints the version and provider info

If terraform: command not found appears, the binary is not on your PATH. Reopen your shell or add the install directory (for example /usr/local/bin) to PATH.

Install Terraform by platform

#

Choose your operating system or distribution for a complete, tested walkthrough including repository setup, verification, and troubleshooting.

Debian & Ubuntu

#

RHEL, Fedora & RPM

#

Arch & openSUSE

#

Other Linux & BSD

#

macOS, Windows & tooling

#

Frequently asked questions

#

How do I install Terraform on Linux?

#

Add HashiCorp's official repository for your distribution, then install with your package manager: apt install terraform on Debian/Ubuntu, or dnf install terraform on RHEL/Fedora/Rocky/AlmaLinux. On distributions without a HashiCorp repo, download the official binary and place it on your PATH. Each platform guide above has the exact commands.

What is the easiest way to install Terraform?

#

On macOS, Homebrew (brew install hashicorp/tap/terraform) is the quickest. On Linux, the official apt or dnf repository is easiest because upgrades come through your normal system updates.

How do I check that Terraform installed correctly?

#

Run terraform --version. It prints the installed version and platform. If you see command not found, the binary is not on your PATH.

How do I install a specific Terraform version?

#

Use tfenv to install and switch between versions, or download the exact version's binary from HashiCorp's releases. Package managers install the latest stable release by default.

Next steps

#

Once Terraform is installed, get hands-on:

Hands-On Courses

#

Learn by doing with interactive courses on CopyPasteLearn:

#Terraform#HashiCorp#Infrastructure as Code#Terraform installation#Linux

Share this article