Skip to main content

DMG

Create macOS disk image (.dmg) packages from Darwin binaries

The DMG stage creates .dmg disk images from your macOS binaries. Images are placed in dist/macos/.

Required tools

One of the following must be available:

ToolPlatformNotes
hdiutilmacOSNative; produces compressed UDZO images. Preferred.
genisoimageLinuxCross-compilation fallback.
mkisofsLinuxSecond fallback if genisoimage is absent.

Tool selection is automatic: hdiutil is tried first, then genisoimage, then mkisofs. The stage fails if none is found.

Platform

DMG only processes binary artifacts targeting Darwin (macOS). Binaries for other operating systems are ignored.

Minimal config

crates:
  - name: myapp
    dmgs:
      - {}

Config fields

FieldTypeDefaultDescription
idstringUnique identifier for referencing this config from other stages.
idslistallFilter to specific build IDs.
namestring{{ ProjectName }}_{{ Version }}_{{ Arch }}.dmgOutput filename template.
extra_fileslistAdditional files to include inside the disk image.
replaceboolfalseRemove matching archive artifacts, keeping only the DMG.
mod_timestampstringFixed timestamp for reproducible builds (e.g. {{ .CommitTimestamp }}).
disableboolfalseSkip this DMG config.

Volume name

The volume label is set to the project name. This is the name the user sees when they mount the image in Finder.

Template variables

The name field supports standard template variables: {{ ProjectName }}, {{ Version }}, {{ Arch }}, {{ Os }}, {{ Tag }}.

Full example

crates:
  - name: myapp
    dmgs:
      - name: "{{ ProjectName }}_{{ Version }}_{{ Arch }}.dmg"
        extra_files:
          - LICENSE
          - README.md
        replace: true
        mod_timestamp: "{{ .CommitTimestamp }}"

Multiple configs

You can define several DMG configs per crate, for example to use ids filtering to build separate images for different binary variants:

crates:
  - name: myapp
    dmgs:
      - ids: [myapp-amd64]
        name: "myapp_{{ Version }}_amd64.dmg"
      - ids: [myapp-arm64]
        name: "myapp_{{ Version }}_arm64.dmg"