Skip to main content
The top-level mac configuration contains options for building macOS targets. These options apply to all macOS target types including DMG, PKG, and MAS.

macOS Targets Overview

DMG

Disk image format for direct distribution

PKG

macOS installer component package

MAS

Mac App Store distribution target

Base macOS Configuration

The mac key in your electron-builder configuration applies to all macOS targets:
{
  "build": {
    "mac": {
      "category": "public.app-category.productivity",
      "target": ["dmg", "pkg"],
      "hardenedRuntime": true,
      "gatekeeperAssess": false,
      "entitlements": "build/entitlements.mac.plist",
      "entitlementsInherit": "build/entitlements.mac.plist"
    }
  }
}
For detailed macOS configuration options, see the MacConfiguration interface reference.

DMG Configuration

The dmg key configures Apple Disk Image builds for direct distribution to users.

Basic DMG Example

{
  "build": {
    "dmg": {
      "icon": "build/icon.icns",
      "background": "build/background.png",
      "window": {
        "width": 540,
        "height": 380
      },
      "contents": [
        {
          "x": 140,
          "y": 180
        },
        {
          "x": 400,
          "y": 180,
          "type": "link",
          "path": "/Applications"
        }
      ]
    }
  }
}

DMG License

To add a license agreement to your DMG, create license files in your build resources directory:
1

Create license files

Create files named license_LANG_CODE.txt in your build resources directory. For example:
  • license_en.txt (English)
  • license_de.txt (German)
  • license_ru.txt (Russian)
2

Customize button labels (optional)

Create licenseButtons_LANG_CODE.json files to customize button labels:
{
  "lang": "English",
  "agree": "Agree",
  "disagree": "Disagree",
  "print": "Print",
  "save": "Save",
  "description": "Here is my own description"
}
3

Build

The appropriate license will be displayed based on the user’s OS language. See the ISO 639-1 language codes for supported codes.
For complete DMG configuration options, see the DmgOptions interface reference.

PKG Configuration

The pkg key configures PKG installer builds for macOS.

Basic PKG Example

{
  "build": {
    "pkg": {
      "license": "build/license.txt",
      "installLocation": "/Applications",
      "allowAnywhere": true,
      "allowCurrentUserHome": true,
      "allowRootDirectory": false
    }
  }
}
PKG installers require macOS code signing. For complete PKG configuration options, see the PkgOptions interface reference.

MAS Configuration

The mas key configures Mac App Store (MAS) builds. This target inherits all base macOS options.

MAS Example

{
  "build": {
    "mas": {
      "type": "distribution",
      "category": "public.app-category.productivity",
      "entitlements": "build/entitlements.mas.plist",
      "entitlementsInherit": "build/entitlements.mas.inherit.plist",
      "provisioningProfile": "build/embedded.provisionprofile",
      "hardenedRuntime": false
    }
  }
}

MAS Entitlements

Mac App Store apps require specific entitlements. Create entitlements.mas.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>com.apple.security.app-sandbox</key>
    <true/>
    <key>com.apple.security.application-groups</key>
    <array>
      <string>TEAM_ID.your.bundle.id</string>
    </array>
  </dict>
</plist>
MAS builds require an Apple Developer account, provisioning profiles, and App Store certificates. For complete MAS configuration options, see the MasConfiguration interface reference.

Building Multiple Targets

You can build multiple macOS targets in a single build:
# Build both DMG and PKG
electron-builder --mac dmg pkg

# Build all macOS targets
electron-builder --mac
# Specific targets
electron-builder --mac dmg
electron-builder --mac pkg
electron-builder --mac mas

# Multiple targets
electron-builder --mac dmg pkg

Build docs developers (and LLMs) love