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

Home > Articles > Apple > Operating Systems

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

Evaluating the Upgrade History

When assessing a system, particularly a server, it is critical to know not only where it is now (the current operating system, load, hardware configuration, and so on), but also how the system got to where it is. Was the current operating system a clean installation? Or was it an upgrade? It is possible to figure this out, even if there is no prior system administrator around to ask. Without this knowledge, it is often difficult to correlate behavior that you see with baseline, known behavior.

Among other tasks, the Apple installer performs two actions when installing a package that can help you figure out the history of installed packages and system upgrades. First, the installer writes entries to the installer.log file, located in /var/log, along with several other log files. Second, the installer writes receipts to /Library/Receipts.

In the installer.log file, the installer program writes a running list of packages that it installs on the system. Other entries in installer.log are written by Software Update as it finds new software to install, and software update service, if the machine in question is running Mac OS X Server along with the software update daemon, swupd. An example of an initial system install from installer.log is as follows:

OSInstaller[197]: ==========================================
OSInstaller[197]: Choices selected for installation:
OSInstaller[197]:   Install: "Mac OS X Server"
OSInstaller[197]:   Install: "Essential System Software"
OSInstaller[197]:       BaseSystem.pkg : com.apple.pkg.BaseSystem : 10.5.0.1.1.1192168948

For your purposes, the installer.log may have limited information. The system’s periodic maintenance (in the daily folder at /etc/periodic/daily/600.daily.server) rolls logs—that is, compresses the current log file and starts a new one. Rolling entirely removes the oldest log files from a disk so that the log disk does not fill up. This means that if the server was installed or upgraded months ago, it is unlikely that a record of it will still exist in the installer.log files.

Receipts, on the other hand, do not expire and remain as a record of packages that have been installed.

The Apple installer, after installing the files that it contains (the payload of a component package), places a receipt in the /Library/Receipts directory of the installation volume. An installation receipt is a token that the installer uses to determine whether a package has already been installed on a system. If the installer, on subsequent installations of packages using the same package filename on the same volume, encounters a receipt, it processes the installation as an upgrade.

When the installer encounters a package in Mac OS X v10.5 format, Leopard handles receipts differently than earlier Macintosh operating systems. With earlier package formats, receipts were dropped by package name into /Library/Receipts. Each receipt resembled the original package minus the actual payload. The only way to remove receipts was manually.

Leopard, in contrast, drops receipts for v10.5-format packages into /Library/Receipts/boms (or Bill of Materials). Leopard also adds a new package database to the system, /Library/Receipts/db, which stores the receipts database. (You should not manipulate this database manually, or you risk corruption of its format.) Leopard also adds a command-line utility, pkgutil, to manipulate and query the database.

You can use pkgutil to collect information about a given package:

$ pkgutil --pkg-info com.apple.pkg.BaseSystem
package-id: com.apple.pkg.BaseSystem
version: 10.5.0.1.1.1192168948
volume: /
location: ./
install-time: 1208628236
groups: com.apple.repair-permissions.pkg-group com.apple.FindSystemFiles.pkg-group

You can also display a list of files that were installed by a package:

$ pkgutil --files com.apple.pkg.BaseSystem | less
.
.vol
Applications
Applications/Utilities
Applications/Utilities/Disk Utility.app
(output trimmed for space considerations)

When assessing a system, you can take advantage of the different methods used by Mac OS X v10.5 to format packages and receipts, as well as earlier methods. A system that has been upgraded to v10.5 will have both style receipts for the operating system components. Specifically, if there is a receipt for BaseSystem.pkg in /Library/Receipts on a v10.5 system, the system is an upgrade (that is, not a clean install).

One final note on software installation: While the Apple package formats are useful, not all developers ship their products with package-based installers. Simple drag-and-drop installations are popular due to their ease of use. Third-party and custom installers also exist. You can also download application source code and compile and install it manually. None of these methods uses the Apple installer application and therefore they do not necessarily save a log of their actions, nor do they need to write package receipts.

  • + Share This
  • 🔖 Save To Your Account

Discussions

comments powered by Disqus