Skip to main content
In this lesson/article you will learn how to install Terraform on macOS and Linux. Recommended installation options covered here:
  • macOS — Homebrew (recommended)
  • Manual install — download a specific Terraform binary
  • Linux — Debian/Ubuntu (apt)
  • Linux — RHEL/CentOS/Amazon Linux (yum/dnf)
  • Automation-friendly installs using releases.hashicorp.com
If you are preparing for the HashiCorp Certified: Terraform Associate 004 exam, practice with Terraform 1.2 since the exam content focuses on that version. You do not always need the latest version for learning or exam prep.
Quick comparison of installation methods: If you use macOS and have Homebrew installed, use the HashiCorp Homebrew tap for the simplest install:
This installs the latest Terraform from the tap. If you require a specific version (for example, Terraform 1.2.x) for exam practice, use the manual download instructions below to get the exact binary for your CPU/OS (darwin_amd64 or darwin_arm64).
The image shows a webpage from HashiCorp’s site displaying download options for Terraform, with separate sections for different operating systems like macOS and Windows.
Notes for Homebrew + Apple Silicon:
  • Homebrew installs to /opt/homebrew/bin on Apple Silicon and to /usr/local/bin on Intel macOS. Ensure the Homebrew bin path is in your PATH.

2) Download a specific Terraform version (manual install)

To pin a precise release (recommended for predictable exam/CI environments), download the platform-specific ZIP for the release you need from: After downloading the ZIP (it contains a single terraform executable):
  1. Unzip the archive.
  2. Move the terraform binary into a directory that appears in your PATH (example: /usr/local/bin or /opt/homebrew/bin).
  3. Make it executable (chmod +x if necessary).
  4. Verify the installation.
Example commands (macOS or Linux):
When selecting the correct ZIP on the downloads page, pick the build that matches your CPU and OS: darwin_amd64, darwin_arm64, linux_amd64, linux_arm64, etc.
The image shows a computer screen with the HashiCorp Terraform download page open in a browser, alongside a file explorer window highlighting a "terraform" executable file and a "LICENSE.txt" file.
Expected example output after a correct manual install:
If terraform is not found after copying the binary, confirm the target directory is in your PATH (echo $PATH) and that the binary is executable (chmod +x terraform). Use which terraform to locate the active binary. When in doubt, remove older copies or adjust your PATH to prioritize the intended installation.

3) Linux — Debian / Ubuntu (apt)

HashiCorp maintains an apt repository for Debian/Ubuntu. To add the GPG key, register the repository, and install Terraform:
This installs the latest Terraform available in the HashiCorp apt repository. If you need a specific release version not available in the repo, use the manual ZIP install (see section 2).

4) Linux — RHEL / CentOS / Amazon Linux (yum / dnf)

For RPM-based distributions, enable the HashiCorp RPM repository and install via yum or dnf:
If your distro uses dnf, replace yum with dnf. This approach installs the latest package available in HashiCorp’s RPM repository.

5) Using releases.hashicorp.com for automation

For scripted installs in CI/CD or automated provisioning, prefer the releases listing to fetch exact ZIP URLs directly (no interactive UI). Example release listing for a version like 1.2.2:
Script approach (example pattern):
  1. Download the chosen ZIP from https://releases.hashicorp.com/terraform/<version>/terraform_<version>_<platform>.zip
  2. Unzip, move binary into a PATH directory, and set executable permissions.
This approach ensures reproducible installs across build agents and containers.

Quick troubleshooting

  • command not found after copying the binary:
    • Confirm the install directory is in your PATH (echo $PATH).
    • Confirm the binary is executable: chmod +x /path/to/terraform.
  • Multiple Terraform versions:
    • which terraform shows which binary will be executed. Remove or reorder binaries to control which version is active.
  • Permission errors:
    • Use sudo when moving or writing to system bin directories, or install to a user-writable directory and add it to your PATH.
Useful links and references: Go get Terraform downloaded — for the HashiCorp Certified: Terraform Associate 004 exam, download and use 1.2.x if you want to practice on the same major/minor release used by the exam. In the next lesson/article I’ll show you…

Watch Video