简体   繁体   中英

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 .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM