OSX .pkg installer sometimes does not install .app file

前端 未结 2 2065
臣服心动
臣服心动 2021-01-04 07:07

My Java application has a launcher which is a .app and a helper app which is bundled with it.

I am trying to make .pkg installer with a background image using the fo

相关标签:
2条回答
  • 2021-01-04 07:28

    I have had roughly the same problem. It appears that the OS X installer uses information about already installed packages and application bundles in order to decide where and if to install new packages. As a result, sometimes my installer did not install any files whatsoever, and sometimes it just overwrote the .app bundle in my build tree. Not necessarily the one used to build the installer, but any .app bundle that OS X had found. In order to get the installer to install the files properly I had to do two things:

    1. Tell OS X to forget about the installed package

      sudo pkgutil --forget <package id> Not sure if this is needed for you nor in my case, but it is probably a good idea anyway.

    2. Delete all existing .app bundles for the app. If I didn't do this, the existing app bundle was overwritten on install instead of the app being placed in /Applications. Maybe there is a way to prevent this while building the installer package, but I haven't found it.

    If you can you should probably try to make your application self contained so that users can install it by just drag and dropping it into /Applications. Of course, this only works if you don't need to install anything outside of your .app bundle.

    0 讨论(0)
  • 2021-01-04 07:34

    If you don't want to (or can't expect other users to) hunt down and delete all existing copies of the app as described by villintehaspam, or just really need the app not to be relocated, you can provide a Component Property List file with BundleIsRelocatable set to false.

    An easy way to create a valid version of the plist file is with pkgbuild --analyze; then you can edit the one property and use the file. E.g.:

    pkgbuild --root myapp.root --analyze myapp.plist
    /usr/libexec/PlistBuddy -c 'set :Dict:BundleIsRelocatable false' myapp.plist
    pkgbuild --root myapp.root --component-plist myapp.plist [...other options...] myapp.pkg
    
    0 讨论(0)
提交回复
热议问题