NTG
NTG

Reputation: 83

How to prohibit the .pkg installer from searching included .app (s) in locations different from the specified installation dir,

This issue has been discussed several times on Stackoverfl0w, but unfortunately I did not see any really satisfying solution.

The situation:

(Only included because most previous answers went with the line of "Just dont do it! There is no reason to have multiple version of an application.. etc.", which I agree with for most cases, but not this one.)

We are currently shipping a .pkg file that installs our software package to /Applications/$CompanyName/$SoftwareName_$VersionNumber . Including the Version number in the folder's name and not deleting older versions is necessary since many of our customers use our current release and beta version in parallel, and, furthermore, many customers work with an older version software because they certified it for a specific use case, but they use a current version for current projects.

We used to ship only command line tools and libraries for macOS, therefore it worked totally fine for us over many years.

However, we started porting our GUI applications from Windows only to Windows / macOS / Linux, which are shipped in the .app format under macOS.

The issue:

If an .app is shipped within a .pkg installer, the installer searches the hole disk for old instances of the same .app . If it finds one, it replaces the instance it found (very bad) and also does not place the .app in the specified installation dir (also bad).

Solutions I found:

a) Changing the CFBundleIdentifier of the .app for every released version. Seems not like a clean way to me. I assume it will also cause the .app to appear multiple times in the Launchpad
b) Searching all instances of the .app before the installer does it, zipping them, and extracting them again after the installation. (Also does not sound like a good solution.)

Does someone have a clean way for this? Can not believe that Apple does not have a way of specifying that this behavior should be omitted during the creating of the .pkg.

Is there better documentation then the one I found?:

https://developer.apple.com/library/mac/documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html#//apple_ref/doc/uid/TP40005370-CH100-SW15

http://s.sudre.free.fr/Stuff/Ivanhoe/FLAT.html (Good documentation, but after ~8 years of uptime, a lot of the fields are still labeled with "Description Forthcoming.")

EDIT: Added XCode as a Tag. Bumping after earning the tumbleweed with this question. Would appreciate any suggestion :)

Upvotes: 1

Views: 316

Answers (1)

stremeor
stremeor

Reputation: 11

The "relocate" property in the distribution file seems to control this. Unfortunately, it appears you can only enable "relocation" by adding this key, but not disable it by omitting the key. According to Apple's Distribution XML documentation, the default for .app bundles is "relocate".

Upvotes: 1

Related Questions