The Fancy Apple Disk Image Creator
mkdmg is a powerful, modern CLI wrapper around hdiutil designed to make creating, signing, and notarizing macOS Disk Images (.dmg) effortless.
- 🚀 Simple: Create DMGs with a single command.
- ⚙️ Configurable: JSON configuration for reproducible builds.
- 📦 Formats: Supports multiple DMG formats (
UDZO,UDBZ,ULFO,ULMO). - 🔐 Security: Integrated codesigning and notarization workflow.
- 🖥️ Filesystems: Support for both HFS+ and APFS.
- 🛡️ Sandbox: Create sandbox-safe disk images.
You can download the latest pre-built binaries for macOS (Darwin) from the GitHub Releases page.
- Visit the releases page.
- Download the archive matching your architecture (
x86_64orarm64). - Extract the archive and move the
mkdmgbinary to a directory in yourPATH(e.g.,/usr/local/bin).
Requires Go 1.26 or later.
go install al.essio.dev/cmd/mkdmg@latestTo build from a local checkout:
make buildTo verify the integrity of the downloaded binary, you can use the checksums.txt file provided in the GitHub Releases.
- Download the binary archive and the
checksums.txtfile. - Run the following command to verify the checksum:
sha256sum -c checksums.txt --ignore-missingmkdmg [OPTION]... [OUTFILE.DMG [DIRECTORY]]mkdmg reads its configuration from a JSON file (default: mkdmg.json in the current directory). You can optionally provide positional arguments to override the output path and source directory from the config.
# Use default config (mkdmg.json)
mkdmg
# Use a specific config file
mkdmg --config path/to/config.json
# Override output path and source directory
mkdmg MyApp.dmg ./build
# Override output path only (source_dir must be in config)
mkdmg MyApp.dmg
# Dry run to preview commands
mkdmg --dry-run --verbose| Flag | Shorthand | Description | Default |
|---|---|---|---|
--config |
Path to a JSON configuration file. | mkdmg.json |
|
--dry-run |
-s |
Simulate the process without creating any files. | false |
--verbose |
-v |
Enable verbose output for mkdmg. |
false |
--version |
-V |
Print version information and exit. | |
--help |
-h |
Display the help message and exit. |
All build settings are defined in the JSON configuration file.
{
"volume_name": "MyApplication",
"volume_size_mb": 0,
"sandbox_safe": false,
"bless": false,
"filesystem": "HFS+",
"signing_identity": "",
"notarize_credentials": "",
"image_format": "UDZO",
"hdiutil_verbosity": 0,
"output_path": "./dist/MyApplication.dmg",
"source_dir": "./build/Release",
"simulate": false
}| Field | Type | Default | Description |
|---|---|---|---|
volume_name |
string |
(Filename) | Name of the mounted volume. Defaults to output_path filename if empty. |
volume_size_mb |
number |
0 |
Volume size in megabytes. If 0, hdiutil calculates the minimum size automatically. |
sandbox_safe |
boolean |
false |
Enables sandbox-safe mode. Incompatible with APFS. |
bless |
boolean |
false |
Blesses the folder/volume (makes it bootable/auto-open). |
filesystem |
string |
"HFS+" |
Filesystem type. Options: "HFS+", "APFS". |
signing_identity |
string |
"" |
Name or hash of the code signing identity to use. |
notarize_credentials |
string |
"" |
Profile name for notarytool credentials. |
image_format |
string |
"UDZO" |
DMG format. Options: "UDZO" (zlib), "UDBZ" (bzip2), "ULFO" (lzfse), "ULMO" (lzma). |
hdiutil_verbosity |
number |
0 |
Verbosity level for the underlying hdiutil command. |
output_path |
string |
(Required) | Destination path for the .dmg file. |
source_dir |
string |
(Required) | Directory containing files to package. |
simulate |
boolean |
false |
If true, prints commands without executing them. |