macOS Universal Binaries

GoReleaser can create macOS Universal Binaries - also known as Fat Binaries. Those binaries are in a special format that contains both arm64 and amd64 executables in a single file.

Here's how to use it:

# .goreleaser.yml
universal_binaries:
-
  # ID of the source build
  #
  # Defaults to the project name.
  id: foo

  # Universal binary name template.
  #
  # Defaults to '{{ .ProjectName }}'
  name_template: '{{.ProjectName}}_{{.Version}}'

  # Whether to remove the previous single-arch binaries from the artifact list.
  # If left as false, your end release might have both several macOS archives: amd64, arm64 and all.
  #
  # Defaults to false.
  replace: true

Tip

Learn more about the name template engine.

The minimal configuration for most setups would look like this:

# .goreleaser.yml
universal_binaries:
- replace: true

That config will join your default build macOS binaries into an Universal Binary, removing the single-arch binaries from the artifact list.

From there, the Arch template variable for this file will be all. You can use the Go template engine to remove it if you'd like.