Install Terraform on MacOS

Install Terraform on MacOS

Play this article

Installing Terraform on MacOS is pretty simple, we have several different ways of doing it:

  • Using Homebrew

  • Manual Installation from binary

  • Using TFSwitch

Official Terraform documentation.

Using TFSwitch

I will start with the third method because I like the tool. TFSwitch is an open-source project that allows you to easily switch Terraform's version. TFSwitch is created and maintained by warrensbox, here the GitHub repo.
Before starting make sure to uninstall Terraform if you have it already installed.

To install TFSwitch we can use homebrew:

brew install warrensbox/tap/tfswitch

Using Homebrew

If you want to stick to the classical Terraform installation, you can still use homebrew:

brew install hashicorp/tap/terraform

You can verify your current version with:

terraform -v

Manual Install

Terraform is distributed as a single binary, you can find the latest version on Terraform website.
After downloading Terraform we can simply put the binary in a directory listed in PATH.

mv ~/Downloads/terraform /usr/local/bin/

To check if the installation is working properly:

terraform -v