macospackagepkgbuildproductbuildmacos-installer

Creating a pkg installer for MacOs with the ability to install in the user's home directory


I want to create a pkg file to install the bundle in the user directory (/Users//Applications/).

How can I do it?

I used the product build with the transfer of the file to the product:

productbuild --component ./Bundle.app --product ./file.plist

file.plist contains

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>home</key>
  <true/>
</dict>
</plist>

But it does not work...

Is it possible to achieve this behavior with pkgbuild or productbuild ?


Solution

  • I figured out how to do it.

    1. pkgbuild --root <path to app> --identifier <identifier> --scripts <path to scripts>--install-location Applications/Name.app Package.pkg

    2. productbuild --synthesize --package ./Package.pkg Distribution.xml

    3. Editing a file Distribution.xml by adding a tag in installer-gui-script: <domains enable_anywhere="false" enable_currentUserHome="true" enable_localSystem="false"/>

    4. productbuild --distribution ./Distribution.xml --package-path ./Package.pkg Product.pkg