lockout87
lockout87

Reputation: 11

How to Force install location from OSX .pkg

I'm attempting to create a package installer for our product. Previously we installed with a .dmg, and the process was to just drag it to the /Applications folder. Now we want it to install to /Application/Company/Suite/product.

Problem is: If we use the .pkg installer on a system that previously had our product installed it creates the folders, but installs the product over the old location.

How can I make the pkg installer do the following:

  1. Remove the old version
  2. Install new version to proper location

I've had very little experience with OSX - so maybe I'm just missing something? Also looking in the applications folder - it doesn't appear that anything else is installed to a subdirectory, is it unusual to do things this way? Thank you!

EDIT: I'm looking into the answers located here OSX .pkg installer sometimes does not install .app file, differently worded problem - but the answer might be just what I need.

EDIT2: OSX .pkg installer sometimes does not install .app file Does not apply. We didn't install with any package manager - so there isn't a previous entry.

EDIT3: We were using dmg, but are now moving to pkg.

Upvotes: 1

Views: 3156

Answers (1)

lockout87
lockout87

Reputation: 11

So I found the answer.

In order to have it install to a new location: The plist inside the app package (product.app/Contents/Info.plist) has an identifier "CFBundleIdentifier", these needs to be different from the old application. For instance ours was "Company.Product-Name", I've changed it to "Company.Product.Name". This will allow the new installation to go to the new location.

In order to remove the old installation: I simply added this line to the preinstall script: "sudo rm -Rf '/Application/Product Name.app'"

Thank you for your assistance.

Upvotes: 0

Related Questions