Install Terraform legacy versions on new mac with M series chips

Rahul Vashishth
WeTheITGuys
Published in
2 min readFeb 13, 2024
Install legacy terraform on macbook with m series laptop

If you are to work on any terraform project with version 1.0 or below on a newer macbook with M series silicon chips, you should follow through this article. Apple released the first macbook with silicon chips in 2021, the silicon chips are based on darwin_arm64 architecture. Though with time everyone started to release the silicon arm64 based builds for their apps, but most did not rebuild their legacy releases so did Terraform.

For this article, we will be installing terraform version 0.14.11 on macbook m3 with Sonoma OS installed on it.

  1. Install GNU grep
  2. Install tfenv
  3. Install tf 0.14.11

It is best to install tfenv in order to work on multiple terraform versions without going through the hassle of uninstalling/re-installing different versions or working through the os env paths. tfenv, it itself requires gnu grep. Even though macos comes preinstalled with BSD grep, this might not work with tfenv. Use the following command to install the gnu grep. --build-from-source is required to build arm64 flavor for the new silicon chip.

brew install grep --build-from-source

Once installed you will be required to set this newly installed grep on mac path export PATH=”/opt/homebrew/opt/grep/libexec/gnubin:$PATH” make sure to cross-check the path from the brew install logs.

Install tfenv using brew install tfenv

This one is interesting, HashiCorp did not provide official arm64 builds for macOS for older versions of Terraform like 0.14.11. The arm64 builds for macOS were introduced in later versions. This means that you will not find an arm64 version of Terraform 0.14.11 on the HashiCorp release page. Luckily we can install older terraform using tfenv as below

TFENV_ARCH=amd64 tfenv install 0.14.11
tfenv use 0.14.11

now you might think why use amd64 arch on mac? macOS on Apple Silicon (M1, M2, etc.) can run amd64 (x86_64) binaries through the Rosetta 2 translation layer. We can install the amd64 version of Terraform 0.14.11 using tfenv by specifying the amd64 architecture.

That’s all, you should be set up to work on legacy terraform, i were you upgrading the terraform version would be my top priority. Do leave comments or reach out to me if you face any issues replicating this in your local developer machine.

Author: Rahul Vashishth

--

--

Rahul Vashishth
WeTheITGuys

Tech Enthusiast, Cloud, Kubernetes, Java, DevOps. Environmentalist.