将tfswitch安装到Mac上

在Linux上安装tfswitch。
这篇文章是关于mac版的。

tfswitch是什么?

公式链接:https://warrensbox.github.io/terraform-switcher/

因为似乎缺乏日语资料,所以我打算重新记录一下使用方法。

只需选择您想要使用的版本!!

$ tfswitch
Use the arrow keys to navigate: ↓ ↑ → ← 
? Select Terraform version: 
  ▸ 0.14.4 *recent
    0.14.3
    0.14.2
    0.14.1
↓   0.14.0

安装过的版本被标注为*recent。
只需选择未安装的版本,自动安装并可立即使用。
新版本发布后会自动添加到选项中。

以上!太容易了!

我没有使用过其他的方法,但在官方网站上有相关介绍。
官方网站上有其他使用方法,我没试过。

安装

公式链接:https://tfswitch.warrensbox.com/Install/#homebrew。

在macOS Mojave上进行了测试。

$ brew install warrensbox/tap/tfswitch
(省略)

$ terraform --version
bash: /usr/local/bin/terraform: No such file or directory
(初回、なにもバージョン指定していない状態だとエラーになる)

$ tfswitch
✔ 0.14.0
Downloading https://releases.hashicorp.com/terraform/0.14.0/terraform_0.14.0_darwin_amd64.zip to terraform_0.14.0_darwin_amd64.zip
Downloading ...
34386076 bytes downloaded.
Switched terraform to version "0.14.0"
$ terraform --version
Terraform v0.14.0

Your version of Terraform is out of date! The latest version
is 0.14.4. You can update by downloading from https://www.terraform.io/downloads.html
$ tfswitch
✔ 0.14.4
Downloading https://releases.hashicorp.com/terraform/0.14.4/terraform_0.14.4_darwin_amd64.zip to terraform_0.14.4_darwin_amd64.zip
Downloading ...
34312707 bytes downloaded.
Switched terraform to version "0.14.4"
$ terraform --version
Terraform v0.14.4

故障排除

在安装tfswitch之前已经安装了terraform,因此收到了要求执行brew unlink的提示。
我认为可以卸载它。

公式故障排除请点击这里查看:https://tfswitch.warrensbox.com/Troubleshoot/。

广告
将在 10 秒后关闭
bannerAds