Skip to main content
This guide explains how to install Terraform on macOS and Linux. You can choose between several methods depending on your environment and needs:
  • Homebrew (recommended for macOS and available on Linux)
  • Your distribution’s package manager (apt for Debian/Ubuntu, yum/dnf for RHEL/CentOS/Amazon Linux)
  • Manual download of a specific binary from HashiCorp releases
Use the method that best fits your requirement for ease of updates (Homebrew / package repos) or strict version control (manual download).

Quick comparison

If you use macOS and already have Homebrew installed, use HashiCorp’s Homebrew tap to install and upgrade Terraform easily:
If Terraform is not installed yet, your shell will report:
If you must use a specific Terraform version (for example, when preparing for the HashiCorp Certified: Terraform Associate exam), the Homebrew tap installs the latest by default. To use an older or specific version, download the desired binary from HashiCorp’s downloads page or use versioned packages if available in the tap.

Downloading a specific version from the HashiCorp site

On the HashiCorp downloads page you can choose a specific Terraform version and the correct binary for your OS / CPU architecture (for example darwin_arm64, darwin_amd64, linux_amd64, linux_arm64).
A dark-themed HashiCorp Terraform "Install" webpage showing binary download sections for Windows and Linux. It lists architectures (386, AMD64, ARM, ARM64) with version 1.2.2 and Download buttons.
Choose the correct platform and CPU architecture (for example, darwin_arm64 for Apple Silicon or darwin_amd64 for Intel). Installing the wrong architecture will result in an executable that won’t run.

Using apt on Debian / Ubuntu

HashiCorp publishes an apt repository for Debian-based systems. Add the repository key and source, then install Terraform:

Using yum / dnf on RHEL / CentOS / Amazon Linux

For RPM-based distributions, add HashiCorp’s repository and install Terraform:

Manual download and installing the binary on your PATH

If you prefer to download a ZIP and install Terraform manually, follow these steps:
  1. Download the correct ZIP for your OS and architecture from the downloads or releases page.
  2. Unzip the archive — it contains a single terraform executable.
  3. Move the terraform executable to a directory that is included in your PATH, for example /usr/local/bin or /opt/homebrew/bin.
Here is a macOS Finder screenshot showing the downloaded terraform executable inside the extracted folder:
A macOS screenshot showing the HashiCorp Terraform install webpage in a browser with a Finder window open, highlighting a downloaded "terraform" Unix executable in a folder named terraform_1.2.2_darwin_arm64. The Finder sidebar shows common locations like Applications, Downloads, and iCloud Drive.
When moving the terraform binary into system directories such as /usr/local/bin, you may need sudo (for example, sudo mv terraform /usr/local/bin/). On Apple Silicon, Homebrew typically installs to /opt/homebrew/bin — ensure you move the binary to the correct location for your system.

Example: macOS Apple Silicon, Terraform 1.2.2

Assuming you downloaded and extracted terraform_1.2.2_darwin_arm64:
Expected example output from terraform version:

Determining your PATH and locating an existing Terraform binary

To view the directories in your PATH:
Common directories where executables can be placed:
  • /usr/local/bin
  • /usr/bin
  • /usr/sbin
  • /opt/homebrew/bin (Homebrew on Apple Silicon)
If Terraform is already installed and you want to know which binary will be executed:
or
Both commands print the full path to the Terraform executable that your shell will run.

HashiCorp releases site (releases.hashicorp.com)

For scripting or CI pipelines, or to obtain direct links to specific versions, use the releases site:
A browser screenshot of releases.hashicorp.com showing a vertical list of blue links for HashiCorp projects and plugins (e.g., packer-plugin-*, terraform, sentinel, serf). A cursor is hovering near the "terraform" link.
Navigate to the terraform directory, pick the version you need (for example terraform_1.2.2), and download the matching ZIP for your platform. Each release ZIP contains a single terraform executable. Example listing you may find in a release folder:

Validation and troubleshooting

  • Confirm installation and view the installed version:
  • If a command is not found:
  • To locate which binary will be executed:
If you see unexpected version output, check whether another Terraform binary earlier in your PATH is being used. Use echo $PATH to inspect search order.

Summary

  • For macOS, Homebrew is the simplest: brew tap hashicorp/tap && brew install hashicorp/tap/terraform.
  • For Debian/Ubuntu and RPM-based distros, use HashiCorp’s apt or yum/dnf repositories for system-managed installs and upgrades.
  • To pin a specific version (for exams, CI, or reproducible environments), download the release ZIP from HashiCorp, extract the terraform binary, and move it into a PATH directory.
  • Use which terraform, command -v terraform, and terraform version to verify the installation and locate the executable.
Further configuration (initializing a project and creating Terraform configurations) will be covered in the next article.

Watch Video