TechnologyHomebrew Terraform: Install & Update on macOS
Install Terraform on macOS via Homebrew (brew install terraform): pin versions, upgrade safely, manage versions with tfenv, and fix common errors.
Technology
Install Terraform on Linux, macOS, Windows, or BSD. Quick apt, dnf, and brew commands plus step-by-step guides for Ubuntu, Debian, RHEL, Fedora, Arch, and 50+ platforms.
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.
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 terraformThen confirm the install:
terraform --versionYou should see Terraform v1.12+ on linux_amd64, darwin_arm64, or your matching platform.
apt upgrade, dnf upgrade, or brew upgrade keeps Terraform current alongside the rest of your system. Best for workstations and CI runners..terraform-version file so everyone runs the exact same version./usr/local/bin. Each guide below shows the exact steps.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 infoIf 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.
Choose your operating system or distribution for a complete, tested walkthrough including repository setup, verification, and troubleshooting.
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.
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.
Run terraform --version. It prints the installed version and platform. If you see command not found, the binary is not on your PATH.
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.
Once Terraform is installed, get hands-on:
Learn by doing with interactive courses on CopyPasteLearn:
TechnologyInstall Terraform on macOS via Homebrew (brew install terraform): pin versions, upgrade safely, manage versions with tfenv, and fix common errors.
TechnologyInstall Terraform on Ubuntu 22.04 and 24.04 LTS using the official HashiCorp apt repository. Covers GPG key setup, version pinning, upgrades, and verification.
Compare Terraform with OpenTofu, Pulumi, Ansible, AWS CDK and CloudFormation, plus core concept guides like for_each vs count and plan vs apply.
TechnologyStep-by-step guide to install Terraform on RHEL using YUM. Configure HashiCorp repository and verify installation. Step-by-step guide with code examples and ...