TerraformPilot

Technology

Install Terraform on Mac with Homebrew (brew install terraform 2026)

Step-by-step guide to install Terraform on macOS with Homebrew. Covers brew tap hashicorp/tap, version pinning, upgrading, multiple versions with tfenv, and troubleshooting common install errors.

LLuca Berton3 min read
Install Terraform on Mac with Homebrew (brew install terraform 2026)

Quick Install (TL;DR)

#
brew tap hashicorp/tap
brew install hashicorp/tap/terraform
terraform --version

That's it — three commands and you're running Terraform 1.12+ on macOS. Read on for version pinning, multiple-version management, and troubleshooting.

Prerequisites

#

Before you begin, make sure you have:

  • macOS 13 Ventura or newer (Intel or Apple Silicon)
  • Homebrew installed — if not, run:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  • Terminal access — use Terminal.app, iTerm2, or any shell

Verify Homebrew is working:

brew --version
# Homebrew 4.4.x (or newer)

Step 1: Add the HashiCorp Tap

#

HashiCorp maintains an official Homebrew tap with all their tools (Terraform, Vault, Packer, Consul, etc.):

brew tap hashicorp/tap

Expected output:

==> Tapping hashicorp/tap
Cloning into '/opt/homebrew/Library/Taps/hashicorp/homebrew-tap'...
Tapped 2 casks and 28 formulae (87 files, 1015.4KB).

Why use the official tap? The hashicorp/tap/terraform formula is maintained by HashiCorp and always has the latest release. The default terraform formula in homebrew-core may lag behind.

Step 2: Install Terraform

#
brew install hashicorp/tap/terraform

Output on Apple Silicon (M1/M2/M3/M4):

==> Fetching hashicorp/tap/terraform
==> Downloading https://releases.hashicorp.com/terraform/1.12.1/terraform_1.12.1_darwin_arm64.zip
==> Installing terraform from hashicorp/tap
🍺  /opt/homebrew/Cellar/terraform/1.12.1: 3 files, 92.1MB, built in 3 seconds

Step 3: Verify Installation

#
terraform --version
Terraform v1.12.1
on darwin_arm64

If you see the version number, Terraform is installed correctly.

Step 4: Enable Shell Autocomplete

#

Terraform supports tab-completion for commands and arguments:

terraform -install-autocomplete

Then restart your shell (or run source ~/.zshrc). Now you can type terraform pl + Tab → terraform plan.

Upgrading Terraform

#

Upgrade to Latest Version

#
brew upgrade hashicorp/tap/terraform

Check for Available Updates

#
brew outdated hashicorp/tap/terraform

Pin a Specific Version (Prevent Auto-Upgrade)

#

If your team requires a specific version:

brew pin hashicorp/tap/terraform

To unpin later:

brew unpin hashicorp/tap/terraform

Managing Multiple Terraform Versions with tfenv

#

Many teams run different Terraform versions per project. tfenv is a version manager (like nvm for Node.js):

Install tfenv

#
brew install tfenv

Important: If you already have Terraform installed via Homebrew, unlink it first:

brew unlink terraform

Use a Specific Version

#
tfenv install 1.12.1
tfenv install 1.9.8
tfenv use 1.12.1

Auto-Switch Per Project

#

Create a .terraform-version file in your project root:

echo "1.12.1" > .terraform-version

tfenv automatically switches when you cd into the directory.

List Installed Versions

#
tfenv list
* 1.12.1 (set by /Users/luca/.terraform-version)
  1.9.8

Alternative Install Methods

#

Method 1: Direct Binary Download

#

If you prefer not to use Homebrew:

curl -LO https://releases.hashicorp.com/terraform/1.12.1/terraform_1.12.1_darwin_arm64.zip
unzip terraform_1.12.1_darwin_arm64.zip
sudo mv terraform /usr/local/bin/
terraform --version

Method 2: Using asdf Version Manager

#
brew install asdf
asdf plugin add terraform
asdf install terraform 1.12.1
asdf global terraform 1.12.1

Troubleshooting Common Issues

#

Error: "terraform: command not found"

#

Your shell can't find the binary. Fix:

# Check where Homebrew installed it
brew --prefix hashicorp/tap/terraform
 
# Add to PATH if needed (for Apple Silicon)
echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

Error: "Cannot install terraform because conflicting formulae are installed"

#

You have both the core formula and the HashiCorp tap:

brew uninstall terraform
brew install hashicorp/tap/terraform

Error: "terraform: already installed" (But Wrong Version)

#
brew unlink terraform
brew link hashicorp/tap/terraform

Permission Denied Errors

#
sudo chown -R $(whoami) /opt/homebrew
brew install hashicorp/tap/terraform

Apple Silicon: "Bad CPU type in executable"

#

You're running an Intel binary on ARM. Reinstall:

brew uninstall hashicorp/tap/terraform
brew install hashicorp/tap/terraform

Homebrew will fetch the correct darwin_arm64 build.

Verify Your Setup Works

#

Create a quick test to confirm everything is operational:

mkdir ~/terraform-test && cd ~/terraform-test
 
cat > main.tf << 'EOF'
terraform {
  required_version = ">= 1.9"
}
 
output "hello" {
  value = "Terraform is working on macOS!"
}
EOF
 
terraform init
terraform apply -auto-approve

Expected output:

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
 
Outputs:
 
hello = "Terraform is working on macOS!"

Clean up:

cd ~ && rm -rf ~/terraform-test

Uninstalling Terraform

#

If you need to remove Terraform:

brew uninstall hashicorp/tap/terraform
brew untap hashicorp/tap  # Optional: remove the tap entirely
#

Frequently asked questions

#

How do I install Terraform on Mac with Homebrew?

#

Run brew tap hashicorp/tap then brew install hashicorp/tap/terraform. Confirm it worked with terraform --version. Homebrew installs the latest stable Terraform and keeps it updated through brew upgrade.

How do I update Terraform on macOS?

#

Run brew upgrade hashicorp/tap/terraform. To check your current version first, run terraform --version. HashiCorp releases updates frequently, so upgrading periodically is recommended.

Does Terraform work on Apple Silicon (M1/M2/M3)?

#

Yes. Homebrew installs the native darwin_arm64 build automatically on Apple Silicon Macs, and the same brew install hashicorp/tap/terraform command works on both Intel and Apple Silicon.

How do I install a specific Terraform version on macOS?

#

Use tfenv: brew install tfenv, then tfenv install 1.12.0 and tfenv use 1.12.0. tfenv lets you switch between versions per project with a .terraform-version file.

Hands-On Courses

#

Learn by doing with interactive courses on CopyPasteLearn:

Conclusion

#

Installing Terraform on macOS with Homebrew takes under a minute. For team environments, use tfenv to manage multiple versions and add a .terraform-version file to each project. Keep your installation updated with brew upgrade hashicorp/tap/terraform — HashiCorp releases new versions frequently with bug fixes and new provider features.

#HashiCorp#Infrastructure as Code#macOS#Terraform installation#Homebrew

Share this article