Adding license to a DMG file in 5 minutes or less
If you want to add License Agreement to a DMG file it is both hard and easy to do at the same time. It is hard, because Apple’s documentation related to the topic is dated back in 2003. Easy, because once you learn it you can do it in less then 5 minutes. I have wasted 30s of your time. It looks like we have ~4 minutes left.
Let’s start.
1. Download the slas_for_udifs_1.0.dmg from Apple’s Developer page (you can use free developer account for that)
Go to https://developer.apple.com/downloads/index.action, in Search field type in “SLAS” and download the DMG file (Software Licensing for UDIF)
2. Mount the slas_for_udifs_1.0.dmg image – simply double click it. You will find two files there: SLA Instructions.rtf and SLAResources
3. Open Terminal and execute following commands
cd /Volumes/SLAs_for_UDIFs_1.0 DeRez SLAResources > /tmp/sla.r
Note! It may turn out that you have to download “Command Line Tools for Xcode” in case you have Mac with OS X Lion preinstalled.
4. This file – /tmp/sla.r – is a resources file with license definition. Your license will be based on this file
5. Open /tmp/sla.r and change it according to your needs
Basically, you can leave following sections:
data 'TMPL' (128, "LPic") { /* leave the content as is */ } data 'LPic' (5000) { /* leave the content as is */ } data 'STR#' (5000, "English buttons") { /* leave the content as is */ } data 'STR#' (5002, "English") { /* leave the content as is */ } data 'TEXT' (5000, "English SLA") { "This is the place where you want to\n" "add your license\n" } data 'styl' (5000, "English SLA") { /* leave the content as is */ }
6. Unflatten image file with your app installer
hdiutil unflatten your_image_file.dmg
Note! If you don’t know how to build Disk Image, check this post: http://www.owsiak.org/?p=683
7. Add license resources
Rez -a /tmp/sla.r -o your_image_file.dmg
8. Flatten your image file
hdiutil flatten your_image_file.dmg
9. Now, you have a nice looking license in your DMG based app installer. Check my “licensed” DMG file below.
Thank you, i’ve been looking for these directions for a couple of days now, and finally found them here! Before stumbling across this page, i thought the only way to get that EULA in there was via Packagemaker (too bad i had to write an installer before coming here ;) )
Thanks!
O.M.G.
Can’t tell how MUCH I thank you. Spent my entire working day on it and finally, indeed, 5 minutes.
Haven’t said enough. Thank you thank you thank you.
snowHarfang – great to hear you have saved your time :)
I don’t understand, last week hdiutile flatten and unflattend worked just fine on my dmg and today it says
hdiutil: unflatten: “/tmp/pack.temp.dmg” cannot be unflattened
hdiutil: unflatten failed – Unsupported operation (or something like that)
Would you see any obvious reason for that to happen ? The dmg on which I run the command is not the same so this is the only clue I have. Maybe there is a special format to use when creating the dmg file (?).
If by chance it is ever likely to help someone : when I create my dmg file in the UDZO format I can flatten/unflatten it. In UDRW I can’t.
…I am on Mountain Lion.
Thanks for this comment. I will take a look at that and update tutorial if necessary.
Could you please recommend an editor to edit the sla.r file? I am on Mountain Lion. ResEdit doesn’t work. ResKnife doesn’t see the sla.r file.
In fact, I am using plain text editor for that. No special editor here.
I was trying to do the same for YEARS…
I even found a perl script which was supposed to do the work for me (but it didn’t under new Xcode distribution).
Thank you VERY much!
This is ALMOST perfect. The only fault is that after
DeRez SLAResources > /tmp/sla.r
sla.r is actually an invalid resourse
data ‘LPic’ (5000) {
$”0000 0002 0000 0000 0000 0000 0004 0000″ /* ……………. */
};
must be instead
data ‘LPic’ (5000) {
$”0000 0002 0000 0000 0000 0001 0004 0000″ /* ……………. */
};
If it is not – there is no menu to choose a language and you cannot switch between English and French. I found the error reading the documentation in the .dmg, the file Script.h from Frameworks and playing with Rezilla.
The ‘1’ is defined in Script.h as
verFrance = 1, /* F fr_FR*/
Hi Jimmy,
Can you point me some documents about .dmg? I’m trying to add an html file as the EULA into my dmg file, but I don’t know how to do that. I can add the EULA the way mentioned in this article, and the language selection menu do show up if I change the .r file as you said, but when I use Rezilla to open the dmg, it says the resource fork is empty.
There are two resources worth reading:
First one is the book: Apple Training Series Mac OS X Deployment v10.6
You can find it here. It covers various topics that might be interesting for developers (e.g. how to create nice looking dmg files)
http://techbus.safaribooksonline.com/book/operating-systems-and-server-administration/mac-os-x/9780321684516
Second resource is here:
http://adcdownload.apple.com/Developer_Tools/software_licensing_for_udif/slas_for_udifs_1.0.dmg
But I think you need Developer’s account to download it.