dmgbuild accepts, as one of its arguments, a settings file. This is in fact a Python script, which means anything you can do in Python code, you can do in your settings file. This makes it easy for you to customise the behaviour of dmgbuild.

Each of the available settings is documented below; all of them are optional; the dmgbuild program has defaults for those that matter. The default values are visible from within your settings file, if you want to examine or alter them rather than replacing them completely.

If any -D key=value settings have been made on the command line, they are visible in a dictionary named defines within the settings file.

Disk Image Settings


If defined, overrides the output filename specified on the command line. The command line value is the default value.


If defined, overrides the volume name specified on the command line, which is the default value.


Specifies the format code for the final output disk image. Must be one of the types supported by hdiutil on the build system; currently the list includes

Code Meaning
UDRO Read-only
UDCO Compressed (ADC)
UDZO Compressed (gzip)
UDBZ Compressed (bzip2)
UFBI Entire device
IPOD iPod image
UDxx UDIF stub
UDSB Sparse bundle
UDSP Sparse
UDRW Read/write
UDTO DVD/CD master
DC42 Disk Copy 4.2
RdWr NDIF read/write
Rdxx NDIF read-only
ROCo NDIF Compressed
Rken NDIF Compressed (KenCode)

For disk images you intend to distribute over the Internet, you should probably stick to ‘UDZO’ and ‘UDBZ’.


If defined, specifies the size of the filesystem within the image. If this is not defined, dmgbuild will attempt to determine a reasonable size for the image.

If you set this, you should set it large enough to hold the files you intend to copy into the image. The syntax is the same as for the -size argument to hdiutil, i.e. you can use the suffixes ‘b’, ‘k’, ‘m’, ‘g’, ‘t’, ‘p’ and ‘e’ for bytes, kilobytes, megabytes, gigabytes, terabytes, exabytes and petabytes respectively.

Content Settings


A list of files (or folders) to copy into the image. Each of these is copied to the root of the image; folders are copied recursively. e.g.:

files = [ '/Applications/' ]

A dictionary specifying symbolic links to create in the image. For example:

symlinks = { 'Applications': '/Applications' }

Specifies the path of an icon file to copy to the volume. You can either specify this, or as an alternative you can use the badge_icon setting.


As an alternative to the above, if you set badge_icon to the path of an icon file or image, it will be used to badge the system’s standard external disk icon. This is a convenient way to construct a suitable icon from your application’s icon, e.g.:

badge_icon = '/Applications/'

A dictionary specifying the co-ordinates of items in the root directory of the disk image, where the keys are filenames and the values are (x, y) tuples. e.g.:

icon_locations = {
    '': (100, 100),
    'Applications': (300, 100)

Window Settings


A string containing any of the following:

Example Meaning
#3344ff Web-style RGB color
#34f Web-style RGB color, short form (#34f = #3344ff)
rgb(1,0,0) RGB color, each value is between 0 and 1
hsl(120,1,.5) HSL (Hue Saturation Lightness) color
hwb(300,0,0) HWB (Hue Whiteness Blackness) color
cmyk(0,1,0,0) CMYK (Cyan Magenta Yellow Black) color
goldenrod X11/SVG named color
builtin-arrow A simple blue arrow image (retina enabled)
/foo/bar/baz.png The path to an image file

The hue component in hsl() and hwb() may include a unit; it defaults to degrees (‘deg’), but also supports radians (‘rad’) and gradians (‘grad’ or ‘gon’).

Other color components may be expressed either in the range 0 to 1, or as percentages (e.g. 60% is equivalent to 0.6).

For no background, specify None instead of a string value.


Each of the above controls the display of one of the standard window elements. All of them default to False.

The width of the Finder sidebar.


The position of the window in ((x, y), (w, h)) format, with y co-ordinates running from bottom to top. The Finder makes sure that the window will be on the user’s display, so if you want your window at the top left of the display you could use (0, 100000) as the x, y co-ordinates. Unfortunately it doesn’t appear to be possible to position the window relative to the top left or relative to the centre of the user’s screen.


The default view for the window; should be a string containing one of:

View name

Whether or not to show icon previews for the contents of the disk image (defaults to False)


Set these to True to force inclusion of the icon/list view settings respectively. By default, dmgbuild will only include settings for the default view type.

Icon View Settings


If set, indicates that the Finder should arrange the icons in the icon view according to the specified field. Allowable settings are:

Field name

Any other value disables automatic icon arrangement (which is the default, since the main use-case for dmgbuild is building application distribution images, where icon positioning is an important part of the design).


Specifies the grid offset for automatic arrangement.


Specifies the grid spacing for automatic arrangement.


As of Mac OS X 10.10 Yosemite, Finder checks to make sure that grid_spacing is less than 100. If it is over that value, it will reject the saved settings.


An (x, y) tuple specifying the scroll position; this is only relevant if you position icons outside of the window area.


Specifies the position of the icons’ labels. Choose ‘bottom’ or ‘right’ (defaults to ‘bottom’).


Specifies the point size of the label text. Default is 16pt.


Specifies the size of icon to use. Default is 128pt.


If arrange_by is not set, a dictionary mapping the names of items in the root of the volume to an (x, y) tuple specifying their location in points.

List View Settings

In list view, the following columns are available:

Field name

Sets the size of the icon in list view. Default is 16pt.


Sets the size of the text in list view. Default is 12pt.


Specifies the scroll position, assuming there are enough items to make the view scroll.


Specifies which column the Finder should sort the display by. Defaults to ‘name’.


If True, formats dates using words like “Today” or “Yesterday” where possible; otherwise they will be displayed as a full date. Defaults to True.


If True, forces the Finder to compute all of the item sizes; normally this is set to False because it can be expensive calculating the sizes of deeply nested folders. Defaults to False.


A list or tuple of strings containing the names of columns, in the order you want them to appear.


A dictionary specifying the width, in points, for each of the columns. There are default widths for every column, so you may not need to set this variable in practice.


A dictionary specifying the sort direction (either ‘ascending’, or ‘descending’) for each column. Again, there are individual defaults for each column, so you may not need to touch this unless you wish to override the default behaviour.

License Settings

dmgbuild can attach license text to your disk image; this will be displayed automatically when the user tries to open your disk image.

Note that license text is either RTF, or it must be encoded in the legacy Mac encoding matching its language; dmgbuild will try to do this, but the built-in set of codecs in Python doesn’t cover all the Mac encodings, so in some cases you will need to encode the data and use a byte string.


If defined, a dictionary specifying the details of the license to display. It has the following keys:

Key Optional Value
default-language No The name of the default language to display if there is no license matching the system language.
licenses No A dictionary mapping language names to license text (either RTF data or plain text).
buttons Yes A dictionary mapping language names to a sequence of user interface strings.

Supported languages are:

English, French, German, Italian, Dutch, Swedish, Spanish, Danish, Portuguese, Norwegian, Hebrew, Japanese, Arabic, Finnish, Greek, Icelandic, Maltese, Turkish, Croatian, TradChinese, Urdu, Hindi, Thai, Korean, Lithuanian, Polish, Hungarian, Estonian, Latvian, Sami, Faroese, Farsi, Persian, Russian, SimpChinese, Flemish, IrishGaelic, Albanian, Romanian, Czech, Slovak, Slovenian, Yiddish, Serbian, Macedonian, Bulgarian, Ukrainian, Byelorussian, Belorussian, Uzbek, Kazakh, Azerbaijani, AzerbaijanAr, Armenian, Georgian, Moldavian, Kirghiz, Tajiki, Turkmen, Mongolian, MongolianCyr, Pashto, Kurdish, Kashmiri, Sindhi, Tibetan, Nepali, Sanskrit, Marathi, Bengali, Assamese, Gujarati, Punjabi, Oriya, Malayalam, Kannada, Tamil, Telugu, Sinhalese, Burmese, Khmer, Lao, Vietnamese, Indonesian, Tagalog, MalayRoman, MalayArabic, Amharic, Tigrinya, Oromo, Somali, Swahili, Kinyarwanda, Ruanda, Rundi, Nyanja, Chewa, Malagasy, Esperanto, Welsh, Basque, Catalan, Latin, Quechua, Guarani, Aymara, Tatar, Uighur, Dzongkha, JavaneseRom, SundaneseRom, Galician, Afrikaans, Breton, Inuktitut, ScottishGaelic, ManxGaelic, IrishGaelicScript, Tongan, GreekAncient, Greenlandic, AzerbaijanRoman, Nynorsk

The user interface strings are as follows:

Index Comment Typical English text
0 Language name English
1 Agree button label Agree
2 Disagree button label Disagree
3 Print button label Print
4 Save button label Save
5 Instruction text If you agree with the terms of this license, press “Agree” to install the software. If you do not agree, press “Disagree”.

There are built-in user interface strings for the following languages:

English, German, Spanish, French, Italian, Japanese, Dutch, Swedish, Portuguese, SimpChinese, TradChinese, Danish, Finnish, Korean, Norwegian

For other languages, if you don’t specify a suitable set, dmgbuild will use the English defaults instead.

dmgbuild will auto-detect RTF data by looking for the string {\rtf1 at the start of the data. If it does not find this string, it will assume that you have supplied plain text.