nordvpn

Install specific version of terraform mac with brew

In this tutorial I will show you how to install specific version of terraform on Mac with brew. There are times when we need to use specific version of terraform on Mac and it’s not easy to install it. So I am going to show you how you can achieve it.

You might also like:  How to install Terraform on macOS Big Sur with Homebrew

Install Terraform on Mac with brew

Let’s see which terraform is currently installed.

~ terraform -version
Terraform v0.14.8
Your version of Terraform is out of date! The latest version
is 1.0.0. You can update by downloading from https://www.terraform.io/downloads.html

So I have installed terraform version 0.14.8. So, let’s try to install version 0.12.3.

Note: Warning: terraform@0.12 has been deprecated because it is not supported upstream!

~ brew install terraform@0.12

~ echo 'export PATH="/usr/local/opt/terraform@0.12/bin:$PATH"' >> ~/.zshrc

~ terraform -version
Terraform v0.12.31

Better way of switch terraform version

There is a better way to switch terraform version instead of doing it manually or relinking it.

Install tfenv with brew

We are going to use tfenv to switch terraform version. tfenv makes it easier to switch to different terraform versions.

Note: Please `brew unlink terraform` before continuing.

~ brew install tfenv 

 ~ tfenv --version
tfenv 2.2.2 

Install specific version of terraform mac

tfenv install 0.14.3

~ tfenv list
1.0.0
0.14.3
No default set. Set with 'tfenv use <version>'

As the not says you have to set the  default version.

~ tfenv use 1.0.0
Switching default version to v1.0.0
Switching completed

Note: If you see the oldest version installed with brew then you need to uninstall it. You can uninstall using for example brew uninstall terraform@0.12

Check terraform version

Now let’s check terraform version.

~ terraform -version
Terraform v1.0.0
on darwin_amd64

Please let me know how you liked the tutorial. Please comment below what you want to learn next or topics I should write tutorials.
It would be great if you can help me keeping this blog up and running by contributing little bit. You can use the following link to help me.

Buy me a coffeeBuy me a coffee

My photography website: https://chetankphotos.com

Leave a Reply

Your email address will not be published.


*


48-Hour Flash Sale! Courses from just $10.99