https://github.com/alessio/mkdmg
Build fancy DMGs
https://github.com/alessio/mkdmg
build-tool cli disk-image dmg golang macos package shell tools
Last synced: 6 days ago
JSON representation
Build fancy DMGs
- Host: GitHub
- URL: https://github.com/alessio/mkdmg
- Owner: alessio
- License: mit
- Created: 2025-04-23T14:02:41.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2026-02-22T16:39:58.000Z (19 days ago)
- Last Synced: 2026-02-22T20:47:47.252Z (19 days ago)
- Topics: build-tool, cli, disk-image, dmg, golang, macos, package, shell, tools
- Language: Go
- Homepage:
- Size: 82 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# 💿 mkdmg
**The Fancy Apple Disk Image Creator**
[](https://github.com/alessio/mkdmg/actions/workflows/go.yml)
[](https://pkg.go.dev/al.essio.dev/cmd/mkdmg)
[](https://goreportcard.com/report/github.com/alessio/mkdmg)
[](https://github.com/alessio/mkdmg/blob/main/LICENSE)
[](https://github.com/alessio/mkdmg/releases)
mkdmg is a powerful, modern CLI wrapper around hdiutil designed to make creating, signing, and notarizing macOS Disk Images (.dmg) effortless.
---
## ✨ 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](https://github.com/alessio/mkdmg/releases).
1. Visit the [releases page](https://github.com/alessio/mkdmg/releases).
2. Download the archive matching your architecture (`x86_64` or `arm64`).
3. 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.
```sh
go install al.essio.dev/cmd/mkdmg@latest
```
To build from a local checkout:
```sh
make build
```
### Verification
To verify the integrity of the downloaded binary, you can use the `checksums.txt` file provided in the [GitHub Releases](https://github.com/alessio/mkdmg/releases).
1. Download the binary archive and the `checksums.txt` file.
2. Run the following command to verify the checksum:
```sh
sha256sum -c checksums.txt --ignore-missing
```
## 🚀 Usage
```sh
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.
```sh
# 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`
```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. |
---