Install Terraform at macOS

2023/02/012 min read
bookmark this
Responsive image

Table of Contents

  1. Introduction
  2. Download Binary from HashiCorp
  3. Install the HashiCorp Binary at macOS
  4. Conclusion

Introduction

The goal here is to be able to run the below command in your local terminal.

terraform -help

Download Binary from HashiCorp

After downloading the binary for macOS (for instance, after the download you should see terraform_1.4.6_darwin_amd64), once you unzip the binary you should see the terraform binary file.

Install the HashiCorp Binary at macOS

If you're getting an error like "terraform" cannot be opened because the developer cannot be verified, you can try the below setting to avoid this error:

  • System Preferences
  • Security & Privacy
  • Choose General

Once the terraform binary file is allowed on your local machine, run the below code in the terminal to include the terraform file in the path.

Type this to check the current PATH:

echo $PATH

Type this to move the terraform file to the user's PATH folder:

mv ~/Downloads/terraform /usr/local/bin/

Now, if you type the below command and it works, you should see a list of help commands.

terraform -help

Conclusion

Installing Terraform on macOS is straightforward — download the binary from HashiCorp, allow it in your security settings, and move it to a directory in your PATH. You can then verify the installation by running terraform -help.