Adding a Software License Agreement to a DMG file

This thread has moved to my new site here:

As part of the software distribution process I go through at my job (Qforma, Inc), I package up our software for both Windows and Mac. For Windows, I create an installer using NSIS which requires a user to agree to a Software License Agreement (SLA) before installing the software. For Mac, rather than using an installer, I have a customized disk image (DMG) that contains the app and a symlink to the /Applications directory.

Since we require a user to agree to our SLA before using our software on Windows, I wanted to require the same on Mac. I searched the internet for an easy way to add an SLA to a DMG and couldn't find a solution that didn't involve using a third party GUI program. Of course all my build processes are automated and run headless so those GUI programs won't work for me. I also wanted to use utilities built in to OS X (or available through Xcode).

Anyway, I figured out how to add an SLA to a DMG and was able to add it to my automated build process. I figured I'd create a simple python script that'll do it too and share it with everyone.

To use the script, make sure Xcode is installed to the default location (/Developer). Download the file, make it executable, then simply run:


where dmgFile is the path to your DMG file and licenseFile is the path to your plain ascii text license file.

Hopefully someone else will also find this useful.

Oh, and I use the with statement in the script so it's python 2.6 (or python 2.5 if you add from __future__ import with_statement to the top line). If you use the default system python, that means this script works on OS X 10.6+.


Published: July 28, 2011

Author: jmhobbs

Word Count: 327


dmg license mac python sla

  • Tag Cloud


    Copyright © 2015 Jared Hobbs. All rights reserved. Powered by Pelican. The Hobbs Family theme available here.