LinuxmacOSWindows

Where Is the OpenTofu CLI Config File?

OpenTofu reads CLI config from .tofurc at home (opentofu.rc on Windows), settable via TF_CLI_CONFIG_FILE.

Last updated

OpenTofu's global CLI config lives at ~/.tofurc on Linux and macOS, and at %APPDATA%\opentofu.rc on Windows. Early versions used ~/.opentofu.rc on all platforms, so guides from the fork's first year reference the old name. Current builds read the new names; TF_CLI_CONFIG_FILE overrides everything.

The file carries provider installation rules, mirrors, and login tokens. Project-local state stays in the working directory as ever; this file is strictly about the CLI itself. Terraform migrants note the parallel: it plays the terraform.rc role with tofu naming.

Where OpenTofu stores this, by platform

Linux
~/.tofurc

HCL config: provider_installation, mirrors, credentials. Early builds used ~/.opentofu.rc instead. TF_CLI_CONFIG_FILE overrides.

macOS
~/.tofurc

Same file and precedence as Linux. Old ~/.opentofu.rc references in early guides mean this file.

Windows
%APPDATA%\opentofu.rc

Windows keeps the .rc naming. Same TF_CLI_CONFIG_FILE override and provider_installation syntax.

Frequently asked questions

How do I point OpenTofu at a different CLI config?

Set TF_CLI_CONFIG_FILE to the file's path. CI systems inject whole configs this way instead of writing home directories. The variable beats every default location.

Where do I configure a provider mirror?

Same file, provider_installation block. Point network_mirror at your registry and exclude direct origins you want fenced off. Teams commit the pattern to internal docs since every machine needs it.

Notice an outdated path? Let us know.