0

I create an application installer with pkgbuild and productbuild tools on OS X. The package I create installs my application to /Application folder. Now, if I move this application to another location using NSFileManager(using another my app), my package will reinstall it to the new location but the /Application where it is intended to be installed.

This looks like some file path caching, can I somehow "flush the cash" so my pkg will install app to the right location?

I noticed this on Mavericks and El Capitan. I believe this is true for Yosemite too.

andrey.s
  • 789
  • 10
  • 28
  • *my package will reinstall it to the new location but the /Application where it is intended to be installed* - Can you please explain this? Are you trying to say that the install will not install to /Applications, but to where you moved the previously installed application bundle? – TheDarkKnight Oct 23 '15 at 12:20
  • @TheDarkKnight exactly! it tries to install it to the path where I moved the previously installed application bundle – andrey.s Oct 23 '15 at 22:11

1 Answers1

1

if I move this application to another location

OS X doesn't like multiple, identical copies of the same application. The problem is due to the registration of applications when they're seen by Launch Services.

When an application is copied into /Applications, or run for the first time, the application details are registered with Launch Services. When a user runs the application by double-clicking on its bundle, Launch Services looks at the registered applications and decides what actually gets run.

The OS X Installer works in tandem with Launch Services, so when a bundle is due to be copied from a package, it first checks to see if the same application has been registered and exists; if the application has, then the copy won't occur. This can be viewed in the Install logs in /var/log/install.log

Having multiple copies of the same application can get confusing and I recommend you don't do this. If you want to put aside a bundle and re-install, move it to the Trash, which will remove its registration from Launch Services.

TheDarkKnight
  • 27,181
  • 6
  • 55
  • 85