9

Have now used pkgbuild/productbuild to create a product archive, consisting of three packages (application, uninstaller, KEXT), that according to installer installs fine, no errors.

The KEXT is correctly placed in /Library/Extensions and postinstall script loads it nicely.

But my applications are not moved to the /Applications/Company/ folder. The folder is created, but the applications are not placed there.

The process of doing the component plist + distribution XML is so utterly simple so I just cannot fathom what the h*ll can go wrong ?

The package can be "installed" via Pacifist, albeit then the postinstall script is not executed.

Help?

Update:

Analyze phase (application resides in ./pkgbuild/app_path/ folder):

pkgbuild --analyze --root "./pkgbuild/app_path/" app.plist

Build phase:

pkgbuild --root "./pkgbuild/app_path/" \
         --component-plist ./app.plist \
         --install-location "/Applications/Company/" \
         --identifier "com.company.myapp.pkg" \
         --version "1.0" \
         app.pkg

Then the product archive, step 1:

productbuild --synthesize --package app.pkg distribution.xml

distribution.xml is then modified with correct background image, license, etc.

Step 2:

productbuild --distribution ./distribution.xml output.pkg

(I omitted the KEXT package as that works perfectly)

When installing "output.pkg", folder /Applications/Company/ is created but is empty.

SOLVED (see Grahams answer below):

By setting BundleIsRelocatable in the component plist files to false, the applications are put into the correct place.

Viewing the installer log, the application got "relocated" to where my Xcode project built the app, but still create the /Application/Company folder. A "slightly" peculiar behaviour I would say.

OSX version is 10.11.1.

7
  • Please can you edit your question and add the details of the application installer package? What flags and options did you use? What does the post-install script do? Ideally an installer should not need a post-install script. Dec 11, 2015 at 11:22
  • Ok, will do. The postinstall script loads an installed KEXT, so it is needed.
    – Robert
    Dec 11, 2015 at 11:53
  • Is app.pkg the expected size after calling pkgbuild? Does app.pkg work when installed on its own? Dec 11, 2015 at 12:12
  • Size is correct (~ 3MB), and no, it does not work on its own either.
    – Robert
    Dec 11, 2015 at 12:16
  • 1
    Thanks, bmike, I'll change the soved-ish text, because Grahams answer is the correct one. My problem mainly lies within the "fact" that Installer.app relocated my app to where Xcode built the app. I think this is a weird behaviour, but it can be mitigated with the BundleIsRelocatable flag. OSX is latest El Capitan.
    – Robert
    Dec 12, 2015 at 8:45

1 Answer 1

11

Moved Applications

The Installer is likely updating the first copy of the application it finds and not the application in the default install location.

This behaviour is deliberate and allows users to move applications, while retaining the ability to use Installer packages to apply updates.

As a developer you probably have numerous copies of the target application on your Mac. It is likely the last copy you – or Xcode – launched is the one being updated. This can include copies within hidden build folders.

Enforce the Location with BundleIsRelocatable

Setting BundleIsRelocatable flag to false forces Installer.app to use the exact path provided by the package.

Without this flag set, the Installer.app will search the target Mac for matching applications and write the new copy to the discovered location.

  • Try your installer with a clean Mac with a fresh copy of OS X.
  • Look closely at the log output from Installer.app or installer; you will see entries regarding the search and final location of the relocated application.

Report the Bug

That the Installer still created the parent company folder does feel like an error. Please report a bug with Apple.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .