xcodemacoscommand-line-interfacepkgbuildproductbuild

What is the difference between pkgbuild vs productbuild?


I am trying to create a .pkg installer for a CLI on macOS (Monterey). I have come across pkgbuild and productbuild.

They are already installed on my mac.

Where can i read more about what these CLIs do? (not only how to use).

What is the difference between the two?


I came across them from this stack overflow thread: Making macOS Installer Packages which are Developer ID ready


Solution

  • Confusingly the output files (component packages and product archives) of the two commands both have the same extension (.pkg). But you can find out more about a .pkg by looking at the contents, which you can see by right clicking it and selecting Show Package Contents or by running pkgutil --expand my-package.pkg path/to/expand. 4

    Hopefully some of those links provide you with some more reading material about what the commands do. This blogpost details more about using the two commands, and this is a good blog post outlining how the commands can be used to create a custom .pkg installer for a macOS application.