delhi09の勉強日記

技術トピック専用のブログです。自分用のメモ書きの投稿が多いです。あくまで「勉強日記」なので記事の内容は鵜呑みにしないでください。

tfenvインストール時に「Error: Cannot install tfenv because conflicting formulae are installed. terraform: because tfenv symlinks terraform binaries」エラーが発生

tfenvインストール時に以下のエラーが発生したのでメモ

事象

$ brew install tfenv
Updating Homebrew...
==> Downloading https://github.com/tfutils/tfenv/archive/v1.0.2.tar.gz
==> Downloading from https://codeload.github.com/tfutils/tfenv/tar.gz/v1.0.2
#=#=#
Error: Cannot install tfenv because conflicting formulae are installed.
  terraform: because tfenv symlinks terraform binaries

Please `brew unlink terraform` before continuing.

Unlinking removes a formula's symlinks from /usr/local. You can
link the formula again after the install finishes. You can --force this
install, but the build may fail or cause obscure side effects in the
resulting software.
$

環境

Mac OS Catalina 10.15.4

解決方法

以下の記事を参照させて頂いた。
inamuu.com

tfenvの前にterraformをインストールしていると発生するらしい。

実行したコマンド

$ brew unlink terraform
Unlinking /usr/local/Cellar/terraform/0.12.25... 1 symlinks removed
$ brew install tfenv
==> Downloading https://github.com/tfutils/tfenv/archive/v1.0.2.tar.gz
Already downloaded: /Users/{masked}/Library/Caches/Homebrew/downloads/57d000da62948b9bc641a5c4d5aeb1b82c7951025a1c6205baf0ffcc1c2cc5d3--tfenv-1.0.2.tar.gz
🍺  /usr/local/Cellar/tfenv/1.0.2: 20 files, 29.2KB, built in 8 seconds

インストール完了