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
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 identitiesapp-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
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 identitiesRun 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
- Uses AppleScript to customize Finder window
- Sets window bounds to match background image perfectly
- Positions icons automatically based on image dimensions
- Applies background image and icon size settings
-
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