Skip Navigation

DMG for Panther

Community Service Announcement

Despite being titled “DMG for Panther”, it bears mentioning that this article is still relevant to Mac OS X 10.4 (that is, Tiger). Enjoy.

Six months ago I wrote a little tutorial by the name of DMG whose aim was to provide insight into how one might go about creating a Mac OS X disk image with a custom background applied. It was a little convoluted, sure, but it worked.

Things have changed.

Mac OS X 10.3 —otherwise known as Panther— has been released in the interim, introducing several changes to the way DMG customization needs to be handled. For the most part, things have been made easier. Pixture Studio’s IconSizeEnabler is no longer supported, which is a damn shame, but it’s something we’ll just have to accept. I’ve also received a number of questions and suggestions regarding DMG, so I figure it’s high time for a rewrite. Let’s go.

  1. Fire up ‘Disk Utility’, found in /Applications/Utilities/ and hit “New Image” on the toolbar. If you aren’t a fan of toolbars, this can also be done from the menu bar, in Images → New → Blank Image…

    A sheet or dialog will pop up, asking for input. The text you enter under “Save As:” will dictate what the final mounted volume is named, so name it properly. The .dmg file can be renamed, sure, but the title of the mounted volume cannot; so name it properly. It’s “Great Application 3.2”, not “grt_app_v3.2”. Where you save it doesn’t matter so much, but I’ve always been fond of the desktop, so let’s go with Desktop.

    As for the other options, let’s take a look:


    Even though the final .dmg file will be shrink–wrapped so that it only occupies as much space as its contents, the mounted image will occupy as much space as you tell it to. Although it isn’t common, this could cause a bit of a problem for people with very low disk space; so choose a size that is enough to fit everything you want, but not much larger. If your application (or photo collection, or log files, or porn archive) amounts to 44MB, don’t pick the 100MB option… go to ‘Custom…’ and punch in ‘50’.

    But remember: as with all disks, the actual formatted size is smaller than advertised. A brand–new 1MB DMG will only hold about 900KB of data, a 10MB DMG will hold about 9.8MB, and a 100MB DMG about 90MB. Caveat emptor.


    Encryption is really only useful if you want to password–protect the contents of an image (duh), so we’ll only touch on it briefly. If you choose AES–128 you’ll be prompted for a password to bestow upon the DMG. AES–128 is the same encryption standard Apple uses for FileVault… so it’s important that you don’t forget the freakin’ password. Every time somebody tries to mount that disk image, they’ll be prompted for the password. Simple. Secure. Affordable.


    You’ll want to stick with “read/write disk image” for now, I assure you. For the purposes of simple archiving or web distribution, sparse disk images aren’t really suitable… so stick with what’s best.

  2. Now that we’ve created an appropriately–named disk image and the volume has been mounted on the desktop, you can fill it with the goodies you need to fill it with and move on… it’s time to make with the customizing. But before we do, there are a few things to consider (note that “considering things” requires a full step):

    • The default state of new windows in Panther is ‘with sidebar’… which is cool because it allows people to drag–n–drop your application into their applications folder from right there in the window (assuming you’re distributing applications in this DMG). The downside to this is that people can (and will) access the final mounted volume via their sidebar in their normal Finder window… meaning you can’t rely on a solid, predictable window size. Welcome to the world wide web; adjust your background image file accordingly.

    • Never, under any circumstances, customize a folder with “All windows” selected in your view options. I’m surprised I actually got email on this, but if “All windows” is selected you’ll end up customizing the background, icon size, and orientation of (you guessed it) all your Finder windows. Well, at least the ones who don’t have an overriding predefined “This window only” setting.

      Finder view options…

      Not only this, but since “All windows” is a local setting, it won’t be transferred to another computer when you distribute the DMG. When they mount the volume, their “All windows” settings will take control… which is probably a pretty bland display of white backgrounds with arranged–by–name file icons. Always make sure the View Options window is set to alter “This window only.”

    With those in mind, it’s safe to start customizing.

  3. After opening the “View Options” inspector for the volume you’re working on (command–j, or View → Show View Options) and making sure you’re working with the view options for this window only, you can customize the layout and appearance of the volume to your heart’s content. You want labels on the right? Go for it. Snap to grid? Do it. Pink background color? Hell yeah. Background image? Well… that’s the tricky part (and, oddly enough, probably the whole reason you’re reading this guide).

    Background image files (and other resources you might want to use) obviously have to occupy the disk image they’re applied to. If you were to specify the background image as, say… ~/Pictures/Nude/J-Lo.jpg and then send the DMG to your buddy in the next cube, the DMG would look in his ~/Pictures folder; where it probably wouldn’t find the /Nude/J-Lo.jpg it was looking for. The result will be no background image at all; this is bad. To put those all–important image files into the DMG without cluttering it up, we need to hide them. Or better yet: throw them all into a folder that will be hidden.

    In fact, throwing them into a hidden folder is about a billion times better than hiding the file itself because you can always navigate to that folder with “Go to Folder…” (Shift–Command–G) and change things at a later date. You can edit, swap, add to, or delete files from a hidden folder without having to hide and unhide individual files over and over and over again. Timesaver. Cheers to Chris Kiss for suggesting this one.

    Now, hiding the folder (like hiding a file) really hasn’t changed since last time, so I’ll be quick about it:


    If you have the Apple Developer Tools installed, there’s a fun little utility in there that can make things completely invisible; that is: completely hidden from the Finder. Opening up a Terminal window, it goes a little something like this: /Developer/Tools/SetFile -a V /Volumes/YOUR_VOLUME/HIDDEN_FOLDER …where YOUR_VOLUME and HIDDEN_FOLDER are, obviously, the names of your mounted volume and folder–you–want–hidden.

    Once you’ve done this, you might notice that the folder isn’t actually hidden. Fear not: the Finder just hasn’t realized that the folder is hidden. To rectify the situation, you can either Force Quit and relaunch the Finder (Command–Option–Escape, always a favorite), or unmount and remount your volume. Easy.

    dot file

    Of course, if you want an even easier way to do things which, as a bonus, doesn’t require the Developer Tools to be installed, there are always dotfiles.

    In Unix systems, files prefixed with a dot (a period, a full–stop, etc) are invisible to the cursory ls; you need to flag it with the ol’ ls -a to see it. In Mac OS X, the Finder honors the dotfile convention by hiding them from view. This is good. To make a new folder in which to stash your background image files, pop open the Terminal and type mkdir /Volumes/YOUR_VOLUME/.HIDDEN_FOLDER …where (again) YOUR_VOLUME is your volume’s name, and .HIDDEN_FOLDER is whatever you feel like naming the new folder (but with a dot in front of it).

    Now that you have this new invisible folder, you’ll be wanting to put things inside of it. Hit Command–Shift–G (or Go → Go to Folder… in the Finder’s menu bar) and type in the path of your hidden folder: /Volumes/YOUR_VOLUME/.HIDDEN_FOLDER …the folder will pop open, as if by magic.

  4. Now that you have your DMG and a hidden folder inside of it, you need to set the DMG background using the image file which is inside the hidden folder. Popping open the View Options dialog and selecting ‘Picture’ from the list of possible backgrounds, you can now hit the ‘Select…’ button; giving you a standard Open dialog.

    Since the file you want to open is is a hidden folder that the Finder (and thus the open dialog, which navigates your hard drive using the Finder) can’t see, this Open dialog is pretty–much useless to you; but never fear. With our old friend Command–Shift–G, you can have your ‘Go to’ dialog and eat it too, giving it the ol’ /Volumes/YOUR_VOLUME/.HIDDEN_FOLDER treatment at your leisure. Now that you’re inside the hidden folder, you can pick and choose whatever file you want for your precious background image. And you’re done.

  5. With your background customized, your icons arranged, and any other customizations you fancy out of the way, it’s time to make this DMG happen. If you were a foolish person, you’d probably just eject the volume and be on your merry way… distributing that very DMG to anyone and everyone who asked for it. But you aren’t a foolish person, because you know there are two things wrong here:

    1. It isn’t compressed at all… it’s still whatever size you specified at the very beginning of this tutorial, even if you specified 40MB for a DMG containing 2MB of files.
    2. It’s still read/write… so people could alter your DMG and re–release it somewhere. Bastards.

    They key is simple: go back to Disk Utility. There, in the left column, is a list of the DMG files that you’ve created. If you haven’t ejected your volume, it’ll be listed right under the file; but for now that doesn’t matter. Eject it, don’t eject it, I don’t care.

    1. Click your .dmg file in the left column; in other words, select it.
    2. Go up to the menu bar, and choose Images → Convert…
    3. In the dialog that pops up, put in a new name (this just changes the name of the .dmg file, not the title of the mounted volume, as discussed in step one), and change the image format to ‘compressed’.
    4. Hit ‘Save’… voilà.
  6. There is no step six. You’re done.

The image is now customized, compressed, read–only, and ready for distribution. You fought the good fight, and the world is safe again… but for how long?