1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/www/docs/customization/universalbinaries.md
Carlos Alexandro Becker 3c98e86620
feat: create macOS Universal binaries (#2572)
* feat: artifacts.Remove

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* feat: fatbinary

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* feat: run fatbinary on pipeline

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* feat: make archives work with fat binaries

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* feat: make brew work with fat binaries

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* feat: make gofish work with fat binaries

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* test: archive binary fatbin

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* docs: fat binaries

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* test: fix on linux

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* feat(ci): enable fat bins on goreleaser itself

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* refactor: rename to universal binaries

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* fix: config

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* fix: rename prop

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
2021-10-12 14:55:43 -03:00

1.2 KiB

title
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.