Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setting executable path in mac for terraform

Tags:

terraform

I know this is maybe a silly question but I am trying to export my terraform path into my linux path.

My terraform executable sits in a terraform folder under /usr/local/terraform.

I therefore did export PATH=$PATH:/usr/local/terraform/terraform

However, When i try and do terraform (going straight into terminal and type in terraform)it doesnt run. Only when I cd to usr/local/terraform and do a ./terraform then the executable runs.

What am i doing wrong?

like image 246
Adam Avatar asked Dec 20 '17 14:12

Adam


People also ask

How do I install specific Terraform on Mac?

Download the installation fileNavigate to the Terraform download page (https://www.terraform.io/downloads.html). It should list out Terraform downloads for various platforms. Navigate to the Windows section and download the respective version. For this example I am downloading V1.

How do I install Terraform on Mac terminal?

Homebrew is a free and open-source package management system for Mac OS X. Install the official Terraform formula from the terminal. First, install the HashiCorp tap, a repository of all our Homebrew packages. Now, install Terraform with hashicorp/tap/terraform .

Where is Terraform installed?

Install Terraform Extract the package to the folder C:\Program Files (x86) . This path is used as an example. However, you can also the Terraform executable to any other location in your local system. Update the path environment variable to include the folder where your Terraform executable is located.


2 Answers

Just copy your terraform binary and place it in /usr/local/bin/

sudo mv terraform /usr/local/bin

You can now access terraform from your terminal from anywhere.

like image 119
AkshatP Avatar answered Nov 01 '22 20:11

AkshatP


Your PATH should list the directory the executable is in, not the executable itself:

export PATH=$PATH:/usr/local/terraform/
like image 32
duncanhall Avatar answered Nov 01 '22 20:11

duncanhall