tags:

views:

105

answers:

3

I'm building an OS X Installer package for a product. When it is run, the 'Select a Destination' pane has an 'Installing this software requires X MB of space' label. But I can run the same package twice on the same machine, and see the claimed usage vary from, i.e. 85 to 127 MB, neither of which is the actual ~65MB usage of the product.

How does Installer calculate required space?

A: 

I may be wrong but I'm guessing it's an aproxamation set by you the developer. You would put something like "Installing this software requires 120 MB of Space"

I know that when I install a product on my mac, I see what it says it will take, and I see what is currently available, however I NEVER go in and actually check that the software used EXACTLY what it said it would. especially if it's only about 50MB.

rockinthesixstring
+1  A: 

Could the installer be including any other files (Frameworks, StartupItems, Drivers, etc) that your program uses in the file size? If so, then the changes in sizes you are experiencing may be due to you not having those files at one point, and having them at another?

Of course, I could be wrong =]

Michael
+5  A: 

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.

gavinb