I've created a SampleApp.app file from XCode 7.1 and converted it to pkg file and signed it using the product build command and it worked fine. But now the problem is, when I install the pkg the app does not start automatically after installation. Do I need to include any other arguments in my command to make this work? Below is the command that I use to create and sign the pkg.
productbuild --component SampleApp.app /Applications SampleApp.pkg
productsign --sign "Developer ID Installer: xxxxx" SampleApp.pkg SampleApp_signed.pkg
I've also tried to add a postinstall script but that didnt seem to work, I'm not sure if its the problem with my script or command
pkgbuild --root SampleApp.app --identifier com.companyname.SampleApp --scripts startup.sh --install-location /Applications/SampleApp.app SampleApp.pkg
productsign --sign "Developer ID Installer: xxxxx" SampleApp.pkg SampleApp_signed.pkg
My startup.sh file
#!/bin/bash
open -a /Applications/SampleApp.app
exit 0
Usually you would create a postinstall
script, and include it with the --scripts
option.
--scripts scripts-path
The contents of scripts-path is added to the product archive for use by system.run() commands in the distribution. This is valid only for product archives targeted to the OS X Installer application.
So a (very) basic example of postinstall
could launch an app by:
#!/bin/sh
open /path/to/your/app
exit 0