In the article or tutorial i will guide you how to install Terraform on MacOS, Installing Terraform on MacOS is quite simple, there is a unique way of installation.
- Installation for MacOS is the easiest with HomeBrew.
- Manual Installation from Binary
- Using TFSwitch
Check Official Terraform documentation.
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 Installation with Binary
Terraform is distribuited 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
Using TFSwitch
The tfswitch
command line tool lets you switch between different versions of terraform. If you do not have a particular version of terraform installed, tfswitch
will download the version you desire. The installation is minimal and easy. Once installed, simply select the version you require from the dropdown and start using terraform.tfswitch
is available for MacOS and Linux based operating systems.
Before starting make sure to uninstall Terraform if you have it already installed.
To install TFSwitch we can use homebrew, If you do not have homebrew installed, click here.
brew install warrensbox/tap/tfswitch
How to use:
Use dropdown menu to select version
- You can switch between different versions of terraform by typing the command
tfswitch
on your terminal. - Select the version of terraform you require by using the up and down arrow.
- Hit Enter to select the desired version.