Publishers of technology books, eBooks, and videos for creative people

Home > Articles

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

Understanding Image, Installer Package, and Receipt Files

The previous sections of this chapter made occasional reference to receipt, image, and package files, which I refer to elsewhere in this book as well. This section provides essential background on exactly what these files are and how they work.

Image (.dmg) files

Many files that you download from the Web (in fact, almost all Apple files and a healthy minority of non-Apple files) arrive in the form of image files. These files typically have names that end in .dmg (also called a UDIF format). However, you may see image files that end in .img; these are carryovers from an image format originally used in Mac OS 9. Over the past few years, .img files have begun to disappear from the Mac OS X scene; thus, I'm omitting further coverage of them from this book. Some image files may be self-mounting (with an .smi extension) and thus should work even if a mounting application is not available.

Note: For a more technical background on the history and nature of disk-image formats, launch Terminal and type man hdiutil. Then press Return until you reach the sections on compatibility and history.

If you double-click an image file, the image file will mount (more technically referred to as attach). That is, a virtual volume appears, much as if you had mounted some sort of removable media, such as a CD. This generally happens thanks to Mac OS X's DiskImageMounter, a background utility that handles disk-image mounting, although some third-party software, such as StuffIt Deluxe, can also mount image files.

Note: When downloading software from the Web, the image file may self-mount and the original .dmg file may be automatically moved to the Trash, as discussed in "Technically Speaking: Internet-Enabled Disk Images," later in this chapter.

The name of the mounted image may differ from the .dmg file itself, though there's usually some similarity. Double-click the mounted image's icon, if a new Finder window doesn't automatically open, to view its contents and access it from the Finder.

For Apple software updates, the contents of the mounted volume will typically be a package (.pkg) file. A Read Me file or other documentation may also be included. For third parties, the contents may similarly be a .pkg file or a separate third-party installer utility. A VISE Installer is currently the most popular alternative to .pkg files; it makes no use of Apple's Installer utility. Alternatively, the disk image may contain a fully functional version of the software in question, sans installer.

If the image contains an installer package file or some other form of install utility, the next step is to launch the install package or utility. Typically, you can do this by double-clicking the file directly from the image. If this does not work, try copying the file to your hard drive first.

When you've finished doing what you need to do, you unmount the virtual volume (by dragging the Volume icon to the Trash or by clicking the Eject icon next to the image's name in the sidebar of a Finder window). You can also delete any install software you dragged to your drive, as well as the downloaded image file itself (if you don't want to save it as a backup).

If the image file contains a fully functional newer version of the software in question rather than an installer, you simply replace the previous version of that software on your hard drive with the new version on the image.

Note: As I discuss later in this chapter, you can use Disk Utility to create image files—a convenient way to make exact copies of folders, discs, and other items you want to transfer over the Internet.


Figure 3.17 The DiskImageMounter application, highlighted in the CoreServices window.


Figure 3.18 From image file to package file in three steps: left, an image file downloaded from the Web; middle, the virtual volume that appears when you mount the image; right, the package file contained in the volume.

Image files vs. compressed files

When you download software from the Internet, it often arrives in compressed and/or encoded format. Such files typically have a .zip, .sit, .sitx, .bin, .gz, or .tgz suffix. In this case, the first step is to decompress and/or decode the file. You do this either via Mac OS X's "built-in" decompressing software or (if Mac OS X's software is not up to the task) via third-party software such as Stuffit Expander. In many cases, your Web browser is preconfigured to automatically launch Expander if needed.

In some cases, the expanded file will be an image (.dmg) file. If so, the image file will likely mount its virtual volume automatically. (If it doesn't, double-click the image file to mount it.) The resulting software (such as an Installer .pkg file) will now be accessible. You then proceed as described in the previous section.

In many cases, however, the decompressed file will be the "final" software itself, such as an installer or another application. You can use this directly.

Installer package (.pkg) files

A package (also referred to as a bundle) is really a folder in disguise. In this guise, it acts as though it were a single file rather than a folder containing a collection of files. These folders are disguised this way to simplify the user's experience of working with them.

The Installer utility uses one type of package file to install updates. These files typically have a .pkg extension at the end of their name (such as MacOSXUpdateCombo10.3.9.pkg), though you may occasionally see one with an .mpkg extension. This latter type of extension represents a meta-package, which is the first file launched in an installation involving several .pkg files. Launching this file will not result in a successful installation unless all of the additional .pkg files are also in its folder.

One key advantage of this approach to OS updates is that the user sees what looks like a single file rather than the dozens of files scattered among several folders that Mac OS 9 updates typically require. When you double-click this item, it launches the Installer and you're on your way.


Figure 3.19 Inside the Mac OS X 10.4.1 update .pkg file: the Contents folder and the Resources folder.

Receipt files

Receipt files, as their name implies, are used by the OS to maintain a record of what the Installer application has installed. A receipt file is created each time you install new software via a package file. It's stored in a folder called Receipts, located in the root-level Library folder (/Library/Receipts).

When viewed from the Finder, a receipt file appears identical to the matching package file that was used to install the software. In fact, both files have identical names and share the same icon and description ("Installer package") in the Kind line of their Get Info windows. Indeed, if you use the Show Package Contents contextual-menu command to look inside a receipt package, you will see only minor differences between its contents and the contents of its matching Installer package. The biggest difference is that the Archive.pax.gz file, which contains the actual updated software (as noted above in "Technically Speaking: Inside Packages"), is missing from the receipt file. This is why the receipt file is so much smaller than its Installer package sibling—and why you can't use the receipt file to install an update.

In Panther, if you double-click a receipt file, it will initially launch Installer (just as an Installer file would). However, the launch is soon interrupted by an error message stating, "The Installer package {name of file} cannot be opened. The selected package is a receipt." Oddly, Apple appears to have eliminated this helpful alert in Tiger. In Tiger, it lets you go all the way through to where you click the Install button. You then get an error message that says: "There were errors installing the software. Please try installing again." The log files, however, correctly note that the installation failed because the Installer could not extract the appropriate files from the package.


Figure 3.20 The contents of a Receipts folder.

What are receipt files used for?

Receipt files are primarily used by Mac OS X to track the updates you've installed. In theory, this is relevant in several situations:

  • Software Update may use receipt files to determine what software has yet to be installed and, thus, what updates appear in the Software Update window.
  • The Installer application uses receipt files to determine whether a given installation should be listed as a new (full) installation or as an upgrade of an existing one. If it finds a relevant receipt file, it considers the installation to be an upgrade.
  • The Installer application may similarly use these files to check whether a given update can be installed on your computer (that is, it checks to see if the prerequisite software is installed).
  • The First Aid portion of Disk Utility uses the information stored in these receipt files to check the default permissions of files installed by updates so that they can be restored when using Repair Disk Permissions (as described in Chapters 5 and 6).

In reality, however, when I tested the "rules" of how receipts are used, I found the process to be less than completely predictable:

  • In no case did the presence or absence of a receipt file prevent a stand-alone installer from reinstalling an update.
  • A receipt file did sometimes affect whether or not Software Update listed an update, but it did this mainly for non-OS updates (such as for iPod software). For updates of the OS itself, such as an update to Mac OS X 10.3.9, Software Update checks the OS version in a way that does not depend on receipt files. Mainly, it uses information stored in the SystemVersion.plist file, located in /System/Library/CoreServices.

Removing receipt files

If you remove a receipt file in hopes of bypassing Mac OS X's refusal to list or install a given update, don't count on it working. In general, I recommend leaving these receipt files in place; ideally, you want Mac OS X to correctly track what you've installed.

You may, however, occasionally need to remove a receipt file to solve a problem with reinstalling a particular piece of software. For example, suppose you have software such as Apple's Keynote application on your drive. You decide to delete it and reinstall it via a Keynote.pkg file. If the Installer does not permit this reinstall, it's probably because you did not delete the receipt file of the same name from the Receipts folder. If this is the case, follow these steps:

  1. Drag the receipt file for the problem software from its /Library/Receipts folder location to the Trash. (You need to be an administrator to do this.) Do not delete the file just yet: Deleting certain receipt files without successfully reinstalling the same software can cause problems (including failure to start up on restart).
  2. Attempt the problem reinstallation again.
  3. After the software has been successfully reinstalled, a new receipt file is created. You empty the Trash to delete the old receipt file.

If, after doing this, the install still fails, the receipt file is not the cause. Drag the receipt file back to its original location before restarting your Mac. Check for other causes, as described elsewhere in this chapter.

Note: Receipt files are created only by software installed via Apple's Installer utility.

  • + Share This
  • 🔖 Save To Your Account