Installing OpenTofu
Installing via direct download
The most direct method to install OpenTofu is to download it from GitHub releases. Each GitHub release has an Assets section, where you can find the zip
archive for your platform and download it.
Once you download a zip archive from there, you can unzip it and move the tofu
binary into your $PATH, e.g. into /usr/local/bin
on many Unix operating systems.
You could, for example, run these commands:
wget https://github.com/opentofu/opentofu/releases/download/v1.6.0-alpha2/tofu_1.6.0-alpha2_darwin_arm64.zip
unzip tofu_1.6.0-alpha2_darwin_arm64.zip
mv tofu /usr/local/bin/tofu
to install OpenTofu on an arm64 MacOS system.
You can find the latest GitHub release of OpenTofu here.
Installing on MacOS
Homebrew
OpenTofu is available in the Homebrew Core repository, so you can install it by running:
brew install opentofu
Installing on Linux
OpenTofu is available via PackageCloud and Snapcraft
Debian and derivatives:
curl -s https://packagecloud.io/install/repositories/opentofu/tofu/script.deb.sh -o /tmp/tofu-repository-setup.sh
# Inspect the downloaded script at /tmp/tofu-repository-setup.sh before running
sudo bash /tmp/tofu-repository-setup.sh
rm /tmp/tofu-repository-setup.sh
sudo apt install tofu
RedHat and derivatives:
curl -s https://packagecloud.io/install/repositories/opentofu/tofu/script.rpm.sh -o /tmp/tofu-repository-setup.sh
# Inspect the downloaded script at /tmp/tofu-repository-setup.sh before running
sudo bash /tmp/tofu-repository-setup.sh
rm /tmp/tofu-repository-setup.sh
sudo yum install tofu
Ubuntu (Snapcraft)
If you're on Ubuntu and using Snapcraft you can install OpenTofu by running:
snap install opentofu