AppleApplicationDiskImage Item

An AppleApplicationDiskImage item is a convenience item that has a dependency on the DMG module and whose type is ["dmg.dmg"], and also has rules and properties specific to building drag 'n' drop disk image installers with an application bundle and symbolic link to the /Applications directory.

Any artifacts of product dependencies which are tagged "installable" will be copied into the disk image, provided their file paths are relative to the path specified by the sourceBase property (i.e. are located in that directory). Any artifacts tagged "installable" and which are not relative to sourceBase will be ignored.

Here is what the project file could look like for a simple DMG installer:


  import qbs

  AppleApplicationDiskImage {
      Depends { name: "myapp" }
      name: "My App"
      dmg.volumeName: name
      dmg.iconSize: 128
      dmg.windowWidth: 640
      dmg.windowHeight: 280
      dmg.iconPositions: [
          {"path": "Applications", "x": 128, "y": 128},
          {"path": "My App.app", "x": 256, "y": 128}
      ]
      files: ["background.tiff", "volume-icon.icns"]
      Group {
          files: ["*.lproj/**"] // licenses
          fileTags: ["dmg.license.input"]
      }
  }

For plain disk images whose contents are not a single application bundle, consider the base AppleDiskImage item instead.

AppleApplicationDiskImage Properties

The following properties are available in addition to the ones inherited from AppleDiskImage.

PropertyTypeSinceDefaultDescription
sourceBasestring1.9/ApplicationsThe base directory from which artifacts installed into the disk image will be copied. This directory is always considered to be relative to qbs.installRoot. For example, if the application Example.app exists at qbs.installRoot/Applications/Example.app, and sourceBase is /Applications, the application will be located at /Example.app relative to the disk image root, and therefore its full path when the disk image is mounted would be something like /Volumes/Example-1.0/Example.app.
symlinksstringList1.9["/Applications:Applications"]List of symlinks to create in the disk image. This is specified as a list of strings, each string containing two file paths separated by a colon. The first path is the symlink target, and the second path is the name of the symlink relative to the root of the disk image.