Workaround for Homebrew: “terraform@0.12 has been disabled because it is not supported upstream!”

I needed to install an older version of Terraform on my work Mac, but got this error:

Error: terraform@0.12 has been disabled because it is not supported upstream!

I tried to edit terraform@0.12 and tried to install without success. This is what worked:

HOMEBREW_NO_INSTALL_FROM_API=1 brew install terraform@0.12


?  Source brew install terraform@0.12
Error: terraform@0.12 has been disabled because it is not supported upstream!
?  Source HOMEBREW_NO_INSTALL_FROM_API=1 brew install terraform@0.12
==> Fetching terraform@0.12
==> Downloading https://ghcr.io/v2/homebrew/core/terraform/0.12/manifests/0.12.31
####################################################################################################################################################################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/terraform/0.12/blobs/sha256:21aa5de3857889453b4ec7ed810df350b22838cda61baa7e6db6a0c3946d5891
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:21aa5de3857889453b4ec7ed810df350b22838cda61baa7e6db6a0c3946d5891?se=2023-05-16T20%3A55%3A00Z&sig=Cdb%2F%2FXmhPJNspNN6FdcDiFLysIMJiYZvKxCH
####################################################################################################################################################################################################################### 100.0%
==> Pouring terraform@0.12--0.12.31.monterey.bottle.tar.gz
==> Caveats
terraform@0.12 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have terraform@0.12 first in your PATH, run:
echo ‘export PATH=”/usr/local/opt/terraform@0.12/bin:$PATH”‘ >> ~/.zshrc
==> Summary
? /usr/local/Cellar/terraform@0.12/0.12.31: 6 files, 42.7MB
==> Running `brew cleanup terraform@0.12`…
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
? Source terraform version
Terraform v0.12.31

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

Homebrew: “Permission denied @ rb_file_s_symlink…”

In case you encounter this error below when doing brew update:


==> Homebrew has enabled anonymous aggregate formula and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics have been recorded yet (nor will be during this `brew` run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations
Updated 1 tap (homebrew/core).
No changes to formulae.
Error: Failed to link all completions, docs and manpages:
  Permission denied @ rb_file_s_symlink - (../../../Homebrew/completions/zsh/_brew, /usr/local/share/zsh/site-functions/_brew)
?  tfm git:(master) ? sudo chown -R $(whoami) $(brew --prefix)/*

Copy-and-paste the following in your terminal:

sudo chown -R $(whoami) $(brew --prefix)/*

How to install jshell via Homebrew

At the time of this writing, Java 9 is in beta. I installed because I wanted to check out jshell, Java’s new REPL (read-evaluate-print-loop). On top of the below, I brew-installed jenv (a must for managing different JDK versions).


$ brew install Caskroom/versions/java9-beta
$ jenv add /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home
$ jenv shell oracle64-9-ea
$ java -version
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+102-2016-01-21-003129.javare.4316.nc)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+102-2016-01-21-003129.javare.4316.nc, mixed mode)
$ jshell
|  Welcome to JShell -- Version 9-ea
|  Type /help for help

-> "Hello JDK 9!"
|  Expression value is: "Hello JDK 9!"
|    assigned to temporary variable $1 of type String

I also did the following to get jshell to work:

1. Added to ~/.bash_profile


eval "$(jenv init -)"

2. Added my hostname in /etc/hosts


amp-macbook    127.0.0.1

Cheers, and enjoy learning lambdas!