Friday, October 29, 2021

Larger Files and Smaller Packages on Monterey

Armin Briegel:

I stumbled over this as I was looking for a different new option for pkgbuild in Monterey. In a conversation with the ever awesome Duncan McCracken, he mentioned that the tool had gained an new option, --large-payload, which allows for individual files in the payload to be larger than 8GB.


We have learned that when you use the --compression latest with a --min-os-version of 10.10 or higher the pkg creation uses the Apple Archive compression for the payload, leading to smaller pkg file sizes. I did a few more tests with some other apps and the file compression improvements were between 20% and 25%.

2 Comments RSS · Twitter

FWIW, the `aa` manpage says various algorithms are supported, so who knows what they actually use. Given the significant reduction in file size, I would have guessed `lzma`, not the default `lzfse`.

(Why Apple created yet another archive format is less clear to me. Didn't they already have xar for this?)

In my (very limited) tests, yes, pkgbuild does always seem to use lzma. (Apple have actually been using lzma compression in the payload of macOS update and upgrade packages for years (since 10.10), but there wasn't previously a proper way for anyone else to use it.)

You can determine the compression format by unpacking the Payload file from the xar (using the xar tool or pkgutil --expand) and then using /usr/bin/compression_tool to decompress it. Adding the -v option will show, among other things, the block compression algorithm. (The compression_tool man page has an actual description of the "block compression file format," surprisingly enough. This is the format used for the package payload.)

Leave a Comment