Install Terraform on Mac Machine -
To Install the Terraform on MAC Machine, just copy-paste the below script in your local Machine and execute this script. Or you can execute the given commands in Script one by one but complete script execution is preferred over single line Command Execution.
mac-terraform-install.sh
brew install jq brew install wget cd ~ version=$(curl https://api.github.com/repos/hashicorp/terraform/releases/latest --silent | jq ".tag_name" -r) version=$(echo $version | sed 's/v//g') # get rid of 'v' from version number echo "Installing Terraform $version." url="https://releases.hashicorp.com/terraform/$version/terraform_$(echo $version)_darwin_amd64.zip" wget $url unzip "terraform_$(echo $version)_darwin_amd64.zip" chmod +x terraform sudo mv terraform /usr/local/bin/ echo "Terraform $version installed." rm "terraform_$(echo $version)_darwin_amd64.zip" echo "Install files cleaned up."
Install Terraform on Windows 10 -
Download the appropriate version of Terraform from HashiCorp’s download page. In my case, it’s the Windows 64-bit version.
Make a folder on your C:\ drive where you can put the Terraform executable. I prefer to place installers in a subfolder (e.g. C:\tools) where you can put binaries.
After the download finishes, go find it in File Explorer. Extract the zip file to the folder you created in step 2.
Open your Start Menu and type in “environment” and the first thing that comes up should be Edit the System Environment Variables option. Click on that and you should see this window.
Click on Environment Variables… at the bottom and you’ll see this:
Under the bottom section where it says System Variables, find one called Path and click edit. You’ll then see a list of where to find the binaries that Windows might need for any given reason.
Click New and add the folder path where terraform.exe is located to the bottom of the list. It should look like this when you finish.
Click OK on each of the menus you’ve opened up until there’s no more left.
To make sure that Windows detects the new path, open a new CMD/PowerShell prompt and enter refreshenv
. or close the opened PowerShell window and Open New One.
Verify the installation was successful by entering terraform --version
. If it returns a version, you’re good to go.