Postinstall script in Mac AppStore package created using productbuild

I am working on a mac app that will be distributed via the AppStore. Would it be possible to include a script and some files in the pkg archive that can be copied into the app's sandbox after it has been installed using some sort of a post install hook?
Answered by DTS Engineer in 636862022

That is why I wanted to place those html files in the app's container
after installation so that both the html and resources are in the same
directory hierarchy.

In that case I’d just copy them there when necessary. That is:
  • If the user views the help files immediately, display the from your bundle.

  • If the user downloads extra content, expand it into your container and then also copy of the original content from your bundle.

In most case the copy won’t take extra space due to APFS cloning.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"

Would it be possible to include a script

No. Mac App Store installers can only install a single app with no customisation along these lines.

and some files in the pkg archive that can be copied into the app's
sandbox after it has been installed using some sort of a post install
hook?

Why not embed those files within the app itself?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"

Why not embed those files within the app itself?

Currently those files are within the app. They are basically html files that by default show the content bundled with the app. Users have the option to get extra content from the internet (banners, themes etc) that gets downloaded to the app's container. After upgrading to WKWebView, it seems both the html and resources need to be placed in the same directory hierarchy if the app is sandboxed, otherwise the webpage fails to load local resources. That is why I wanted to place those html files in the app's container after installation so that both the html and resources are in the same directory hierarchy.


Accepted Answer

That is why I wanted to place those html files in the app's container
after installation so that both the html and resources are in the same
directory hierarchy.

In that case I’d just copy them there when necessary. That is:
  • If the user views the help files immediately, display the from your bundle.

  • If the user downloads extra content, expand it into your container and then also copy of the original content from your bundle.

In most case the copy won’t take extra space due to APFS cloning.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Postinstall script in Mac AppStore package created using productbuild
 
 
Q