Cyberithub

How to Install Terraform on macOS Using 6 Easy Steps

Advertisements

In this article, we will see how to install terraform on macOS using 6 easy steps. Terraform is a free and open source Infrastructure-as-code software tool from Hashicorp. It enables and allows us to build and manage multi cloud infrastructure with ease and utmost efficiency. It uses human readable configuration files that can be reused and share to create and manage cloud and on-premise resources. It can create from low level components like compute, storage etc to high level components like DNS entries and other SaaS features.

It allows us to write our own reusable modules for different cloud providers. It keeps track of all the changes in infrastructure resources using a state file that acts as a source of truth for your environment. It is also quiet easy to install and use in almost all the famous platforms like Windows, Linux and macOS. Here we will see the steps to install terraform on macOS based systems.

 

How to Install Terraform on macOS Using 6 Easy Steps

How to Install Terraform on macOS Using 6 Easy Steps

Also Read: How to Install and Use tfenv (Terraform version manager) on macOS

Step 1: Prerequisites

a) You should have a running macOS Server.

b) You should have sudo or root access to run privileged commands.

c) You should have brew utility installed in your Server.

 

Step 2: Update Your Server

Before installing terraform, it is a good idea to check and update all old formulae by using brew update command as shown below.

cyberithub@macos1066 ~ % brew update

 

Step 3: Install Terraform

In the next step, you can install terraform by using brew install terraform command as shown below.

cyberithub@macos1066 ~ % brew install terraform
==> Downloading https://formulae.brew.sh/api/formula.jws.json
#################################################################################################################################################### 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
#################################################################################################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/terraform/manifests/1.5.7
#################################################################################################################################################### 100.0%
==> Fetching terraform
==> Downloading https://ghcr.io/v2/homebrew/core/terraform/blobs/sha256:19dd31b33a7e2bdc5fac6c2351fc62f66a9cf9e00ac724f1b01c43e740c65aa4
#################################################################################################################################################### 100.0%
==> Pouring terraform--1.5.7.monterey.bottle.tar.gz
    /usr/local/Cellar/terraform/1.5.7: 6 files, 70.2MB
==> Running `brew cleanup terraform`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`)

 

Step 4: Check Version

You can the terraform current version by using terraform --version command as shown below.

cyberithub@macos1066 ~ % terraform --version
Terraform v1.5.7
on darwin_amd64

 

Step 5: Check all the available options

To check all the options available with terraform command, you can use terraform --help command as shown below.

cyberithub@macos1066 ~ % terraform --help
Usage: terraform [global options] <subcommand> [args]

The available commands for execution are listed below.
The primary workflow commands are given first, followed by
less common or more advanced commands.

Main commands:
  init         Prepare your working directory for other commands
  validate     Check whether the configuration is valid
  plan         Show changes required by the current configuration
  apply        Create or update infrastructure
  destroy      Destroy previously-created infrastructure
...............................................

 

Step 6: Uninstall Terraform

Once you are done using Terraform, you can choose to uninstall it from your system by using brew remove terraform command as shown below.

cyberithub@macos1066 ~ % brew remove terraform
Uninstalling /usr/local/Cellar/terraform/1.5.7... (6 files, 70.2MB)

Leave a Comment