When should I use a PKG instead of a DMG?
Use a PKG installer package when you need scripted installation, receipts, managed deployment, or a guided installer flow. DMGs are a better fit for drag-and-drop app delivery.
Guide
If you need a macOS installer package for customer releases, internal deployment, or CI packaging, the core workflow is simple: build a package payload, add installer metadata, then sign and notarize it.
Quick answer
The lowest-level way to create a macOS installer package, usually distributed as a.pkg file, is with Apple'spkgbuild andproductbuild tools. That works well for basic packages, but teams usually outgrow hand-maintained commands once scripts, versioning, signing, and repeatable release builds start to matter.
Start with the manual workflow
For a straightforward installer package, place the files you want to install in a payload directory, then point pkgbuild at that directory. This is the usual starting point when you want an app installed into/Applications or need a package for MDM distribution.
Example pkgbuild command
pkgbuild \ --root "./payload" \ --identifier "com.example.myapp" \ --version "1.0.0" \ --install-location "/Applications" \ "./build/MyApp.pkg"
You have one payload, one install location, and limited installer customization.
You need a richer distribution installer, custom choices, or multiple component packages.
Common friction points
Best practice
After the first working package, the main improvement is not a different command. It is storing installer settings in a JSON-based project file that can be reviewed, diffed, versioned, and rebuilt consistently by other people or automation.
Why PKGSmith fits here
PKGSmith gives you a native macOS workflow for PKG and DMG projects, then exposes a build-only CLI for repeatable local and CI builds from the same JSON-based.pkgsmith file.
Repeatable build example
Once the installer definition lives in a project file, the actual build command becomes short and predictable. That is easier to trust in CI than a long handwrittenpkgbuild invocation copied between jobs.
PKGSmith CLI example
pkgsmith build \ --reference "./MyApp.pkgsmith" \ --output "./build/releases" \ --json
Before you ship
Use the correct Developer ID Installer identity for the package you distribute.
Submit the installer with Apple's notarization workflow before public release.
Test on a clean machine or VM so installer behavior matches the real first-run experience.
FAQ
Use a PKG installer package when you need scripted installation, receipts, managed deployment, or a guided installer flow. DMGs are a better fit for drag-and-drop app delivery.
No. A simple component package can be enough. productbuild becomes useful when you need a distribution installer, custom choices, or multiple component packages.
Yes for most public distribution. Users and Gatekeeper expect macOS installers to be signed, and external distribution generally also requires notarization.