A simple CLI tool to create professional DMG installers for macOS applications.
- Creates styled DMG files with custom background images
- Automatically extracts app name from bundle Info.plist
- Automatically sizes DMG window to match background image dimensions
- Positions app icon and Applications folder symlink automatically based on image size
- Sets custom DMG icon by compositing app icon onto drive icon
- Code signing support with identity validation
- Compresses final DMG for distribution
- Markdown to HTML or Slack mrkdwn conversion
Build from source:
swift build -c releaseInstall to /usr/local/bin:
# Copy the binary
cp .build/release/dmgs /usr/local/bin/
# Or create a symlink (recommended for development)
ln -s $(pwd)/.build/release/dmgs /usr/local/bin/dmgsdmgs <app-path> <background-path> [options]
# or explicitly
dmgs create <app-path> <background-path> [options]dmgs identitiesdmgs markdown [<input-path>] [options]Reads from stdin if no input path is specified.
app-path- Path to the .app bundlebackground-path- Path to the background image for the DMG
The app name is automatically extracted from the bundle's CFBundleDisplayName or CFBundleName in Info.plist.
-o, --output <directory>- Output directory for the DMG (defaults to current directory)--icon-size <size>- Icon size in the DMG window (default: 100)--sign <identity>- Code signing identity to sign the DMG (e.g., "Developer ID Application")-v, --verbose- Show verbose output-h, --help- Show help information
-o, --output <path>- Output file path (prints to stdout if not specified)--slack- Output Slack mrkdwn format instead of HTML
Basic usage:
dmgs "/path/to/MyApp.app" "/path/to/background.png"With custom options and code signing:
dmgs "/path/to/MyApp.app" "/path/to/background.png" \
--output ~/Desktop \
--icon-size 120 \
--sign "Developer ID Application: Your Name (TEAM123)" \
--verboseList available signing identities:
dmgs identitiesConvert Markdown to HTML:
dmgs markdown "/path/to/changelog.md"Convert Markdown to Slack mrkdwn:
dmgs markdown "/path/to/changelog.md" --slackSave to file:
dmgs markdown "/path/to/changelog.md" --output "/path/to/output.html"Pipe from stdin:
cat "/path/to/changelog.md" | dmgs markdown --slack
echo "**bold text**" | dmgs markdownRun tests:
swift test-
Configuration
- Extracts app name from Info.plist (
CFBundleDisplayNameorCFBundleName) - Reads background image dimensions
- Calculates optimal window bounds (image size + 22px for title bar)
- Calculates icon positions (app at 1/4 width, Applications at 3/4 width)
- Validates signing identity if provided
- Extracts app name from Info.plist (
-
DMG Creation
- Creates a temporary DMG with auto-calculated size
- Mounts the DMG
- Copies app bundle to DMG
- Creates Applications folder symlink
- Copies background image to
.backgroundfolder
-
Customization
- Writes a
.DS_Storefile directly - Sets window bounds to match background image perfectly
- Positions icons automatically based on image dimensions
- Applies background image and icon size settings
- Writes a
-
Finalization
- Unmounts the DMG
- Converts to compressed, read-only format
- Sets custom DMG icon (app icon composited onto drive icon)
- Signs DMG if signing identity provided
- Verifies signature contains Authority flag
- Cleans up temporary files
The DMG window is automatically sized to match your background image, and icons are positioned proportionally, ensuring a perfect fit with no manual positioning needed.
MIT