DropDMG has a command-line tool called dropdmg that can create disk images and archives and burn CDs and DVDs. This lets you control DropDMG from Terminal and automate it via shell scripts.
To install the command-line tool, click the Install “dropdmg” Tool button in the Advanced section of the Settings window. Once installed, DropDMG will automatically offer to update the tool when a new version is available.
For a list of the available options, type man dropdmg in Terminal.
Detached Settings Files
The Sharing Licenses and Layouts section describes how you can use the dropdmg tool with licenses and layouts that are stored outside of DropDMG, e.g. under version control.
Full User Sessions
The dropdmg tool is not a freestanding utility. Rather, it controls the DropDMG application, which it will launch as needed. You must be logged into the Mac with a regular user session (not only via SSH, although you can control the GUI user session via SSH).
Xcode
On macOS 10.14 and later, if Xcode is running a script that uses dropdmg, it needs Automation access to control DropDMG. The system is supposed to ask you to allow this, but it does not, and there is no way to manually grant Automation access. The workaround is to insert this line at the top of your build script:
osascript -e 'tell application "DropDMG" to get version'
This will get Xcode to ask for access, and then subsequent invocations of dropdmg will work.
Xcode Server
DropDMG is compatible with the Xcode Server build environment. Despite the fact that you can’t see the login session for the _xcsbuildd user, Xcode Server does run your build scripts and UI tests in a graphical macOS user environment. This means that DropDMG can run and that it can talk to the Finder to build disk images with layouts.
Because the _xcsbuildd session is hidden, you cannot interact with it directly. However, you can control DropDMG from an Xcode shell script build phase using the dropdmg command-line tool. You can use the --layout-folder and --license-folder switches to specify the layout and license that are stored in your source control repository.
Additionally, you can use these shell commands to personalize DropDMG, tell it not to show software update alerts, and tell it to quit after processing each dropdmg command (so that it’s not visible in UI test screenshots):
defaults write com.c-command.DropDMG MJTOwnerName2 your-serial-name defaults write com.c-command.DropDMG MJTSerialNumber2 your-serial-number defaults write com.c-command.DropDMG MJTSoftwareUpdateCheckAtLaunch NO defaults write com.c-command.DropDMG QuitWhenDone YES
Jenkins
Make sure that the Jenkins user is logged in and not in the background. While logged into the Mac directly, try making a disk image from Terminal so that macOS will prompt you to give Terminal Automation access to control DropDMG. It will then remember this access when you are invoking DropDMG from Jenkins.
GitHub Actions, Bamboo, and Headless Continuous Integration
In some cases, you may not be able to access the user interface to approve Automation access for DropDMG. You can use this Terminal command to tell macOS to grant access (for all apps) without a GUI prompt:
automationmodetool enable-automationmode-without-authentication