Search code examples
macoslaunch-daemonmacos-installer

How to forget a MacOS bundle to prevent invalid installation


Background

I'm developing some Mac OS daemon. Some times I'm starting it as a application in my repository to test some things. So far so good. I'm able to create installation package which can be used by others no problems at all.

Problem

When I'm using installation package sometimes daemon is not copied to desired path. In installation logs I can see flowing statement:

....
installer: Installation Check: Passed
installer: Volume Check: Passed
installer: Bundle com.mybudle.id will be relocated to /Users/itsMe/repos/MySourceCodeRepo/Debug/MyDaemonApplication.app

Basically installer noticed that in some directory there is bundle with same bundle id, so it decided to skipped its installation in required location. Now since xml which starts my service is using location defined in installation package, service start fails.

Question

Is there some way to inform system to forget my private version of the bundle, without deleting it? I need a way to prevent installer skipping installing some bundles since it found other version of it.


Solution

  • Ok. I've found good explanation of the problem:

    https://apple.stackexchange.com/questions/219123/pkgbuild-created-package-does-not-install-correctly

    So to fix it I've generated myapp_istaller.plist like this:

    pkgbuild --analyze --root "./my_product_root/" myapp_istaller.plist
    

    Then I've change value for BundleIsRelocatable to false inside that file. And finally I feed this plist file when creating a package:

        pkgbuild --root ${PKG_SUBDIR} \
             --component-plist ./myapp_istaller.plist \
             --identifier ${PKG_IDENTIFIER} \
             --version ${APP_VERSION_FULL} \
             --ownership recommended \
             --scripts scripts \
             pkg1/output.pkg
    

    and problem solved. Bundle is intalled only on location defined by installation package.