Install Trunk

Install Trunk

To installtrunk locally, run:

curl https://get.trunk.io -fsSL | bash

For other installation options (npm, brew, direct download, etc), see below.

The Trunk Launcher

This command actually installs the 'Trunk Launcher', which downloads and runs the version of the trunk binary pined your repo's .trunk/trunk.yaml file. This enforces that all users of Trunk in your repo are using the exact same version. While the Trunk binary updates every few weeks, the Trunk Launcher rarely changes and is almost always backward compatible with old versions.

Alternative Installation Options

Use a node package manager to install trunk

Package ManagerCommand
npmnpm i -D @trunkio/launcher
pnpmpnpm add -D @trunkio/launcher
yarnyarn add -D @trunkio/launcher

In package.json you can add scripts to use trunk, such as:

  "scripts": {
    "trunk": "trunk",
    "fmt": "trunk fmt",
    "check": "trunk check"
  },

Use Homebrew to install trunk (macOS only)

brew install trunk-io

https://formulae.brew.sh/cask/trunk-io

Download & run the trunk binary directly (not recommended)

If you prefer, you can directly download the trunk binary as a tarball or just a single binary. We don't recommend this though, because a major design point of trunk is to pin the version of trunk you're using in your repo's .trunk/trunk.yaml file. If you run the binary directly, not via the Trunk Launcher, you are running the version you run, it doesn't matter what is pinned in your repo. If you want to do this anyway, here's where you can find the binary:

Download the Trunk binary directly:

https://trunk.io/releases/${version}/trunk-${version}_${platform}

For example: https://trunk.io/releases/0.2.0-alpha/trunk-0.2.0-alpha_darwin

Download the Trunk binary tarball:

https://trunk.io/releases/${version}/trunk-${version}.${platform}.tar.gz

For example: https://trunk.io/releases/0.2.0-alpha/trunk-0.2.0-alpha.darwin.tar.gz

Note: ${platform} can either be darwin or linux.

Compatibility

trunk requires at least glibc 2.19 and on MacOS, at least macOS 10.15; note, however, that trunk cannot make any guarantees about the minimum system requirements of the various linters and formatters that it will run for you. Trunk does not currently work on Alpine linux.

We generally strive to maintain backward compatibility between the Trunk Launcher and older versions of the Trunk binary, but you may need to occasionally upgrade this package to be compatible with newer versions of the binary.

Add the Trunk Launcher directly into your repo (optional)

To allow your teammates to use Trunk without installing anything, the launcher can be committed directly into your repo; common homes for the launcher are your repo root or a tools/ subdirectory. Once committed, anyone working in your repository can use trunk without any additional installation. Fewer steps == less friction.

From your repo:

curl -LO https://trunk.io/releases/trunk
chmod +x trunk

Uninstalling

Trunk has a very minimal installation, and therefore there's not much to uninstall. The two system paths we use are:

  • /usr/local/bin/trunk: the Trunk Launcher
  • ~/.cache/trunk: cached versions of the trunk cli, linters, formatters, etc.

So, to uninstall the Trunk cli and cache, just delete the above paths:

sudo rm -rf /usr/local/bin/trunk ~/.cache/trunk

To uninstall the Trunk VS Code extension, do so as you would any extension (docs).

Next Steps

Check out:

  • Trunk Merge: a merge queue to make merging code in github safer and easier
  • Trunk Check: an extendable superlinter with a builtin language server and preexisting issue detection
  • Trunk Actions: workflow automation for software engineers

As well as the other ways to use Trunk:


Did this page help you?