macosproductbuild

View package content created with productbuild


I created a pkg file with the productbuild utility and I'd like to see its content. How can I do that?

I'm under MacOS 10.9.5.


Solution

  • You could extract your package into temporary directory with pkgutil.

    pkgutil --expand pkg-path dir-path
    
    Expand the flat package at pkg-path into a new directory specified by dir-path.
    

    There is also very good third party tool called Pacifist, by CharlesSoft. You can view the contents of the package without extracting it.

    Update

    Inside pkg archive (which is a xar archive) you may encounter following files:

    The Mac OS X Installer uses a file system "bill of materials" to determine which files to install, remove, or upgrade. A bill of materials, bom, contains all the files within a directory, along with some information about each file. File information includes: the file's UNIX permissions, its owner and group, its size, its time of last modification, and so on. Also included are a checksum of each file and information about hard links. [man bom]

    You may list the contents of bom file with lsbom command. And create the file with mkbom.

    This xml file contains general information about the package.

    This is a gziped cpio archive. You may extract its contents to current directory with tar command:

    $ tar -xf Payload
    

    Or extract to specified directory dir-path:

    $ tar -C dir-path -xf Payload
    

    Optionally you may only list the contents of the Payload archive with:

    $ tar -tf Payload
    

    You should be able to recreate the archive from dir-path with:

    $ tar --format cpio -czf Payload dir-path