The installer .pkg
file contains several components:
- the archive of files to install
- a bill of materials (metadata listing all the installable files)
- resources for the installation itself (images, scripts, etc)
- an
Info.plist
containing version information and defaults
The bill of materials, or "BOM", contains information such as permissions, file sizes, checksum, and so on. When the installer runs for a package the very first time, the total of the file sizes listed in the BOM is used to estimate the required size. (If there are any shared components, this will obviously affect the total.)
After an installation is complete, the BOM is saved in the package receipts folder (/Library/Receipts/boms
) as a record of what was installed. The lsbom
utility can be used to inspect the contents of these files.
On subsequent installations of the same package (as determined by the package identifier), the BOM receipts are consulted to determine what files are already installed, and their total size. The existing unchanged files are totalled and subtracted from the new files to be installed, while updated files that need to replace older files are taken into account too. The pkgutil
tool can be used to display information about installed packages.
So this is why the installation size estimate can vary across installations. New and existing files add to the total, while existing unchanged files subtract from the installation requirements.