Skip to content

Install

The quickest way to install Terragrunt on Linux or macOS:

Terminal window
curl -sL https://terragrunt.gruntwork.io/install | bash
  1. Go to the Releases Page.
  2. Download the archive for your operating system: e.g., if you’re on a Mac, download terragrunt_darwin_amd64.tar.gz; if you’re on Windows, download terragrunt_windows_amd64.exe.zip, etc.
  3. Download SHA256SUMS and optionally SHA256SUMS.gpgsig for signature verification.
  4. Verify the checksum and optionally the signature (see Verifying the checksum below).
  5. Extract the archive: e.g., tar -xzf terragrunt_darwin_amd64.tar.gz or unzip on Windows.
  6. Add execute permissions to the binary (Linux/Mac): chmod u+x terragrunt.
  7. Put the binary somewhere on your PATH: e.g., On Linux and Mac: mv terragrunt /usr/local/bin/terragrunt.

When you download the binary from the releases page, you can also use the checksum file to verify the integrity of the binary. This can be useful for ensuring that you have an intact binary and that it has not been tampered with.

To verify the integrity of the file, do the following:

  1. Have the binary downloaded, and accessible.
  2. Generate the SHA256 checksum of the binary.
  3. Download the SHA256SUMS file from the releases page.
  4. Find the expected checksum for the binary you downloaded.
  5. If the checksums match, the binary is intact and has not been tampered with.
  6. Optionally, verify the GPG signature:
Terminal window
# Import Gruntwork's public key (first time only)
curl -s https://gruntwork.io/.well-known/pgp-key.txt | gpg --import
# Verify signature
gpg --verify SHA256SUMS.gpgsig SHA256SUMS
  1. Alternatively, verify with Cosign:
Terminal window
cosign verify-blob SHA256SUMS \
--signature SHA256SUMS.sig \
--certificate SHA256SUMS.pem \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
--certificate-identity-regexp "github.com/gruntwork-io/terragrunt"
Terminal window
set -euo pipefail
OS="linux"
ARCH="amd64"
VERSION="v0.99.1"
BINARY_NAME="terragrunt_${OS}_${ARCH}"
BASE_URL="https://github.com/gruntwork-io/terragrunt/releases/download/$VERSION"
# Download binary and verification files
curl -sL "$BASE_URL/$BINARY_NAME" -o "$BINARY_NAME"
curl -sL "$BASE_URL/SHA256SUMS" -o SHA256SUMS
curl -sL "$BASE_URL/SHA256SUMS.gpgsig" -o SHA256SUMS.gpgsig
# First: Import Gruntwork signing key and verify GPG signature of checksum file
curl -s https://gruntwork.io/.well-known/pgp-key.txt | gpg --import 2>/dev/null
if gpg --verify SHA256SUMS.gpgsig SHA256SUMS 2>/dev/null; then
echo "GPG signature verified!"
else
echo "GPG signature verification failed!"
exit 1
fi
# Second: Verify checksum of binary against trusted SHA256SUMS
CHECKSUM="$(sha256sum "$BINARY_NAME" | awk '{print $1}')"
EXPECTED_CHECKSUM="$(awk -v binary="$BINARY_NAME" '$2 == binary {print $1; exit}' SHA256SUMS)"
if [ "$CHECKSUM" != "$EXPECTED_CHECKSUM" ]; then
echo "Checksum verification failed!"
exit 1
fi
echo "Checksum verified!"
echo "Terragrunt $VERSION downloaded and verified successfully"

Note that all the different package managers are third party. The third party Terragrunt packages may not be updated with the latest version, but are often close. Please check your version against the latest available on the Releases Page. If you want the latest version, the recommended installation option is to download from the releases page.

  • Windows: You can install Terragrunt on Windows using Chocolatey

    Terminal window
    choco install terragrunt
  • macOS: You can install Terragrunt on macOS using Homebrew:

    Terminal window
    brew install terragrunt
  • Linux (Homebrew): Most Linux users can use Homebrew:

    Terminal window
    brew install terragrunt
  • Linux (Pacman): Arch Linux users can use pacman:

    Terminal window
    pacman -S terragrunt
  • Linux (Gentoo): Gentoo users can use emerge:

    Terminal window
    emerge -a app-admin/terragrunt-bin
  • FreeBSD: You can install Terragrunt on FreeBSD using Pkg:

    Terminal window
    pkg install terragrunt

A best practice when using Terragrunt is to pin the version you are using to ensure that you, your colleagues and your CI/CD pipelines are all using the same version. This also allows you to easily upgrade to new versions and rollback to previous versions if needed.

You can use a tool manager to install and manage Terragrunt versions.

  • mise: You can install Terragrunt using mise

    Terminal window
    mise install terragrunt v0.99.1
  • asdf: You can install Terragrunt using asdf

    Terminal window
    asdf plugin add terragrunt
    asdf install terragrunt v0.99.1

Both of these tools allow you to pin the version of Terragrunt you are using in a .tool-versions (and .mise.toml for mise) file in your project directory.

Colleagues and CI/CD pipelines can then install the associated tool manager, and run using the pinned version.

Note that the tools Terragrunt integrates with, such as OpenTofu and Terraform, can also be managed by these tool managers, so you can also pin the versions of those tools in the same file.

Backend details:

If you’d like to build from source, you can use go to build Terragrunt yourself, and install it:

Terminal window
git clone https://github.com/gruntwork-io/terragrunt.git
cd terragrunt
# Feel free to checkout a particular tag, etc if you want here.
go install

If you use either Bash or Zsh, you can enable tab completion for Terragrunt commands. To enable autocomplete, first ensure that a config file exists for your chosen shell.

For Bash shell.

Terminal window
touch ~/.bashrc

For Zsh shell.

Terminal window
touch ~/.zshrc

Then install the autocomplete package.

Terminal window
terragrunt --install-autocomplete

Once the autocomplete support is installed, you will need to restart your shell.

Gruntwork offers a commercial CI/CD solution for Terragrunt called Pipelines. Pipelines is a fully managed CI/CD service that is designed to work seamlessly with Terragrunt. It provides an out of the box solution for running Terragrunt in CI/CD without the need to setup and maintain your own CI/CD infrastructure.

Terragrunt is also available as a GitHub Action.

Instructions on how to use it can be found at https://github.com/gruntwork-io/terragrunt-action.