I just downloaded the Terraform binary from the official website and extracted it to a folder on my C: drive. However, whenever I open my terminal or PowerShell and type terraform -version, I get the error message stating it's not recognized as an internal or external command. I thought simply having the exe file was enough. Do I need to perform additional steps in the system environment variables to make it globally accessible across my machine?
3 answers
The reason you are seeing this error is that the Windows Command Prompt doesn't know where the terraform.exe file is located. You need to add the folder path containing that executable to your system's "Path" environment variable. First, search for "Edit the system environment variables" in your Start menu. Click on "Environment Variables," find the "Path" variable under System Variables, and click Edit. Add a "New" entry with the full folder path (e.g., C:\terraform\). Crucially, you must close and reopen any existing terminal windows for the changes to take effect. This is a common step for many DevOps tools like Vault or Packer as well.
Have you tried running the command directly from within the folder where you extracted the file just to verify the binary isn't corrupted? If it works inside the specific directory but fails everywhere else, then your Path configuration is definitely the culprit.
You just need to update your Path in Environment Variables. Once you add the folder location, restart your terminal and it should work perfectly.
I agree with Stephanie. This is a classic "Path" issue. For a cleaner setup, I usually create a folder called C:\bin, add that to my Path, and just drop all my standalone dev tool executables in there.
Joshua, I actually tried that and it works fine when I'm in the folder! That confirms the binary is healthy. My question now is, if I have multiple versions of Terraform for different projects, should I point the Path to a specific version, or is there a better way to manage multiple versions on Windows without manually changing the environment variables every single time I switch tasks?