Skip Navigation

DMG

Before you read this…

This tutorial was written way back when Mac OS X 10.2 Jaguar was current. Things have changed. Good news is, there’s an updated version for 10.3 Panther available.

I learned more today about DMG files than I ever wanted to know. But now that I know what I know, I’m sure I could find a thousand uses for it; it’s a solution looking for a problem. I speak, of course, about the über–nifty DMGs that mount to a fully–customized volume… the kind that software developers everywhere are using to distribute their applications now that stuffit, tarball, zip and gzip are officially passé. I wanted to do that kind of crap… so I set out to figure out how. This is my story.

The first step is simple: decorate a folder on my desktop with a fancy background image, independently resize a few of the icons contained within the folder with IconSizeEnabler, arrange to taste, run the Disk Copy utility, create new image from folder. Bam.

Fail.

The DMG it produces, once mounted, has none of those nifty customizations applied. It’s a big, dumb, white–background, all–icons–the–default–size–and–position, crapfest. To put it succinctly, it’s default. Surf the web a little… particularly when googling “disk image background” and you’ll probably hear about FileStorm. Hell, Apple even recommends it, but if you have even the slightest technical aptitude and any patience, put that $20 back in your goddamn wallet. You wanna be a hotshot software developer? Then act like one, fool. This ain’t no place for WYSIWYG.

  1. Fire up the Disk Copy utility. Yeah, again.
  2. Create a new blank image. No, I didn’t realize you could do that either. Any size will do for now (as long as it’s going to fit whatever you’re cramming into it), later on it’ll shrink–to–fit… so don’t worry about the 10Mb DMG you’re throwing a couple of photos into.
  3. Give it a name, a girl’s name. Charlene. This is what it’ll be called when it’s mounted; the name you type into ‘Save as’ is what the DMG file will be called on your desktop. Disk Copy will create the DMG file for you and mount it, too. Open up the mounted volume… that’s your folder, do what you will to it. Customize, arrange, resize, go nuts.
  4. Are you applying a custom background picture (isn’t that what we came here for? Isn’t that why people fork out twenty bucks for FileStorm? Isn’t buying FileStorm precisely what I told you not to do?) If you are, you must put that picture file (notice I’m avoiding the word ‘image’ right now) into the volume. Must. If you’re sending this shit to your Aunt Flo, how is the volume going to display a custom background picture if that picture is in your Pictures folder? It must be in the volume. That said, we don’t want no stinkin’ picture cluttering up our neat ol’ volume… so how do we conceal it? You got two options, both of them require the Terminal.
    • Before you get all fancy with applying your custom background image, make it a dot file. If you’re unaware of this tenet of Unix file handling… dot files are invisible. It’s just the thing in this situation, but you need to know a little about using Terminal. If your command–line–hymen is still intact, get your virgin ass over to the first three installations of TidBITS Mac User’s Guide to the Unix Command Line and read up. Ready? Great. Using cp, copy (and, by extension, rename) the picture file so there’s a dot at the front of it. Like so: cp /Volumes/YOUR_VOLUME/picture.jpg /Volumes/YOUR_VOLUME/.picture.jpg …Now there’s an invisible copy of the picture in that volume, ls -a that sucker if you don’t believe me. Delete the original, it’s cramping my style. Now you can safely set the background picture without cluttering up the volume! When you go to set it though, instead of trying to navigate around for the file (it’s invisible, silly) just type /Volumes/YOUR_VOLUME’S_NAME_HERE/.picture.jpg in the ‘Go to’ box.
    • Of course, if you don’t like dot files, there’s always the handy SetFile utility included in Apple’s Developer Tools. This time customize your volume’s background before making the picture file invisible (it’s easier that way and you know it), then (in the Terminal once again) type /Developer/Tools/SetFile -a V /Volumes/YOUR_VOLUME/picture.jpg …simple as that. It sets the ‘invisible bit’ on the file… hiding it from the Finder. Voilà.
  5. By now, you have a DMG file, a mounted volume filled with nicely–organized files (some invisible, some not–so–invisible), a custom background image, and (if you’re fond of IconSizeEnabler) different–sized file icons. What next? Well, throw out that DMG file… it’s useless; but don’t eject the volume. Go back to Disk Copy (you didn’t quit it, did you?) and go for the ol’ ‘New Image from Volume or Folder’. Bingo. Select the volume you’ve just spent so long customizing and create a volume from the volume; don’t try to save the new DMG in the mounted volume though, that would suck. Save it to your desktop or any other arbitrary folder and you’re all set. There you are, left with a DMG, what you wanted all along.

The new DMG is the combined size of its contents (no more of that scabby 10Mb shit for you, eh?), is fully customized to your specifications, and is ready to roll. Knock yourself out. So… why did I spend all that time learning this junk from disparate, unhelpful sources? Why have I spent all this time documenting the process so that other lost souls have a place to go? Well, I did a little Disk Imaging of my own today… that’s why.

I saw that Gabe (over at PA, that’s twice this week I’ve mentioned them) created a Penny Arcade icon suitable for use on StarDock’s ObjectDock. While it’s all well and good that the PNG he created works perfectly with ObjectDock, what about us Mac users on the real dock? Well, I spent a little time duffing the PNG into a proper Mac OS X icon resource, then went to all the trouble of packaging it up in a nice neat DMG, which you can download now. I’m such a nice guy sometimes.