Install Terraform on macOS

In this tutorial, I will show you how to install Terraform on macOS!

First, go to the Terraform Download page https://developer.hashicorp.com/terraform/downloads to download the Terraform installation file for macOS. Depending on the chip of your device, please download the appropriate version!

After the download is complete, please unzip this file. You will see only a single file named “terraform” in the file you downloaded.

You can copy this terraform file to any folder. To be able to use this file with the command line in any directory, add the path to the $PATH environment variable, which points to the directory where the terraform file is located.

You can do this by opening the .bash_profile file in the user directory, and then adding the following line:

With /Users/khanh/Downloads/Terraform as my directory containing the terraform file.

Then save this .bash_profile file.

For this configuration to take effect immediately, run the following command:

To check the results, you can run the following command:

Its results are as follows:

At this point, we have successfully installed Terraform on our machines!

Add Comment