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

Tech Must-Reads and Resources

Writing this post to archive my must-reads, in no particular order. Note this is a living post/work-in-progress.

oh-my-zsh: Insecure completion-dependent directories detected

In case you encounter this error on installing oh-my-zsh, do the chmod commands below.


?  ~ source ~/.zshrc                                                                                                  
[oh-my-zsh] Insecure completion-dependent directories detected:
drwxrwxr-x  16 Anton.Perez  admin  512 May  4 10:42 /usr/local/share

[oh-my-zsh] For safety, we will not load completions from these directories until
[oh-my-zsh] you fix their permissions and ownership and restart zsh.
[oh-my-zsh] See the above list for directories with group or other writability.

[oh-my-zsh] To fix your permissions you can do so by disabling
[oh-my-zsh] the write permission of "group" and "others" and making sure that the
[oh-my-zsh] owner of these directories is either root or your current user.
[oh-my-zsh] The following command may help:
[oh-my-zsh]     compaudit | xargs chmod g-w,o-w

[oh-my-zsh] If the above didn't help or you want to skip the verification of
[oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to
[oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file.

zsh compinit: insecure directories, run compaudit for list.
Ignore insecure directories and continue [y] or abort compinit [n]? ncompinit: initialization aborted

Run these:


?  ~ chmod 755 /usr/local/share/zsh
?  ~ chmod 755 /usr/local/share/zsh/site-functions

GitHub: The unauthenticated git protocol on port 9418 is no longer supported

GitHub recently improved security, so you may get the error below like I did when I tried to install oh-my-zsh on a new Mac.


Anton.Perez@amp ~ % sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Cloning Oh My Zsh...
fatal: remote error: 
  The unauthenticated git protocol on port 9418 is no longer supported.
Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.
/Users/Anton.Perez
Error: git clone of oh-my-zsh repo failed

You can test if it’s because you need to add an SSH key by running:


ssh -vvv git@github.com

You’ll get an error like so if so:


...
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
git@github.com: Permission denied (publickey).

If so, just generate a new key and add it to your GitHub account (see this. That’s it!