I’ve just released a new command line tool,
dmgbuild, that automates the
creation of (nice looking) disk images from the command line. There are no
GUI tools necessary; there is no AppleScript, and it doesn’t rely on Finder,
or on any deprecated APIs.
Why use this approach? Well, because everything about your disk image is defined in a plain text file, you’ll get the same results every time; not only that, but the resulting image will be the same no matter what version of Mac OS X you build it on.
If you’re interested, the Python package is up on PyPI, so you can just do
pip install dmgbuild
It’s really easy to use; all you need do is make a settings file (see the documentation for an example) then from the command line enter something like
dmgbuild -s my-settings.py "My Disk Image" output.dmg
The code for editing
.DS_Store files and for generating Mac aliases has been
split out into two other modules,
mac_alias, for those who
are interested in such things. The
ds_store module should be fully portable
to other platforms; the
mac_alias module relies on some OS X specific
functions to fill out a proper alias record, and on other systems those would
need to be replaced somehow. The
dmgbuild tool itself relies on
SetFile, so will only work on Mac OS X.