Installing Terraform on MacOS is pretty simple, we have several different ways of doing it:
Manual Installation from binary
Official Terraform documentation.
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
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 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
mv ~/Downloads/terraform /usr/local/bin/
To check if the installation is working properly: