β¨ Features
- π 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.
π¦ Installation
Pre-built Binaries
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_64 or arm64).
- Extract the archive and move the
mkdmg binary to a directory in your PATH (e.g., /usr/local/bin).
From Source
Requires Go 1.26 or later.
go install al.essio.dev/cmd/mkdmg@latest
To build from a local checkout:
make build
Verification
To 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.txt file.
- Run the following command to verify the checksum:
sha256sum -c checksums.txt --ignore-missing
π Usage
mkdmg [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
βοΈ Options
| 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. |
|
π JSON Configuration
All build settings are defined in the JSON configuration file.
Example mkdmg.json
{
"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
}
Configuration Reference
| 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. |