Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

productbuild path ignored on install

I have an OSX application built with Qt. It is codesigned, packaged up to fit macstore and has been approved by apple and it is ready for sale in the mac store.

Though after installing it, it is installed into the location where it was residing during the packaging process instead of /Applications.

Alternatively I'm creating a .dmg package of the file, which I can install into /Applications.

At the end of the build procedure I'm running these commands:

codesign --force --deep --verify MyApp.app/ --entitlements ${INSTDIR}/Entitlements.plist -s "3rd Party Mac Developer Application: Company Name"
productbuild --component MyApp.app /Applications --sign "3rd Party Mac Developer Installer: Company Name" MyApp.pkg

The result of which is the pkg, which I'm attempting to install via installer:

$ sudo installer -store -pkg MyApp.pkg -target /
installer: Note: running installer as an admin user (instead of root) gives better Mac App Store fidelity
installer: MyApp.pkg has valid signature for submission: 3rd Party Mac Developer Installer: Company Name (key)
installer: Installation Check: Passed
installer: Volume Check: Passed
installer: Bundle com.CompanyName.MyApp will be relocated to /Users/peti/dev/build/bin/Mac/release/MyApp.app
installer: Starting install
installer: Install 0.0% complete
installer: Install 17.1% complete
installer: Install 96.4% complete
installer: Install 100.0% complete
installer: Finished install

Right after productbuild the relocation was saying /Applications, but it didn't install it there!! On a subsequent run it will say the incorrect path. I've also tried installing from different locations.

I've also tried installing the app from Mac Store which does the same... It goes into the incorrect path.

I've used:

pkgutil --expand

To extract the package. PackageInfo file says this:

<pkg-info overwrite-permissions="true" relocatable="false" identifier="com.CompanyName.MyApp" postinstall-action="none" version="3.0.0" format-version="2" generator-version="InstallCmds-502 (14F1605)" install-location="/Applications" auth="root" preserve-xattr="true">

Any ideas what could be going wrong? I've tried to google for solutions, but no luck. Where could this incorrect path be stored? I don't see the path embedded into any file before productbuild. Is productbuild doing something weird?

like image 934
tothphu Avatar asked Apr 19 '16 04:04

tothphu


1 Answers

Finally I think I have an explanation.

It installs correctly on every other machine, except our build machine. What the reason appears to be is that after you execute the named MyApp.app from anywhere on the filesystem osx remembers that path. So when you are trying to install it next time around (update?) it will update the application on the known path.

An even weirder scenario is that when you have two "installations" of the application (two copies) and you are trying to install it again, it will install it alternating between the two instances! Smells like a bug, that Apple is never going to fix.

Thanks for the help @l'L'l. If you could explain me this behaviour that would be a plus.

like image 165
tothphu Avatar answered Nov 07 '22 22:11

tothphu