Skip to content

Terraform

We recommend using tfswitch to manage your Terraform versions.

Install tfswitch:

brew install warrensbox/tap/tfswitch

Install Terraform:

tfswitch --latest

Add the location of the tfswitch binary to your PATH:

export PATH=$PATH:$HOME/bin

Verify that the correct version of Terraform is installed:

terraform version

Persist the location of Terraform versions managed by tfswitch:

echo 'export PATH=$PATH:$HOME/bin' >> ~/.zshrc
echo 'export PATH=$PATH:$HOME/bin' >> ~/.bash_profile

Executable PATH

Once you open a new terminal window the path to the Terraform binary managed by tfswitch will not be set.

To persist the path you must add the same command we ran manually in step 3 to your ~/.bash_profile or ~/.zshrc file. Below is an example of how to do this.

Alternatively you can refer to HashiCorp's guide for installing Terraform