'Terraform:MacOS:zsh: exec format error: terraform [closed]
I first installed brew install terraform and it worked fine
But later I tried to install a specific version as below
wget -P terraform_bin/ https://releases.hashicorp.com/terraform/0.12.0/terraform_0.12.0_linux_amd64.zip
unzip -o terraform_bin/terraform_0.12.0_linux_amd64.zip -d terraform_bin/
mv terraform_bin/terraform /usr/local/bin
rm -rf terraform_bin
terraform version
But now it got messed up with installation in MacOS ,When tried running version its failing
Solution 1:[1]
You're trying to use a Linux binary on a Mac, meaning you downloaded the wrong file.
If you look at your wget
wget -P terraform_bin/ https://releases.hashicorp.com/terraform/0.12.0/terraform_0.12.0_linux_amd64.zip
you will notice that you fetched the Linux version even though you are running on a Mac.
If you go to https://releases.hashicorp.com/terraform/0.12.0 you will see all the files that are available for that version. The one you want is called terraform_0.12.0_darwin_amd64.zip. Bear in mind that this particular file is for the Intel architecture, and it will run on current Apple Silicon Macs, but Hashicorp will likely offer an Apple Silicon or Universal version in which case you will want that.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |

