Does anyone know if there is an easy way of differentiating between an application installed from the App Store and a native/built-in application? Does the OS drop a receipt or a special attribute of some sort that would make this logic fairly easy?
Differentiating between applications
Best answer by mm2270
mdls can show you if an app was installed from the App Store or not. App Store apps have several items in their metadata that indicate App Store. For example, if I do the following against TextWrangler on my Mac, which is installed from the App Store:
mdls /Applications/TextWrangler.app
It shows me a bunch of info, including these lines:
kMDItemAppStoreAdamID = "404010395"
kMDItemAppStoreCategory = "Developer Tools"
kMDItemAppStoreCategoryType = "public.app-category.developer-tools"
kMDItemAppStoreHasReceipt = 1
kMDItemAppStoreInstallerVersionID = "814415319"
kMDItemAppStoreIsAppleSigned = 1
kMDItemAppStorePurchaseDate = 2016-02-14 23:30:19 +0000
kMDItemAppStoreReceiptIsRevoked = 0
kMDItemAppStoreReceiptIsVPPLicensed = 0
kMDItemAppStoreReceiptType = "Production"
Since only App Store apps have any of those items in their metadata, you could pick one of them to use with a mdfind search on the Mac. For example, this should pull up a list of apps installed on the Mac that came from the App Store
mdfind -name 'kMDItemAppStoreHasReceipt = 1'
This produces a nice neat list of all App Store apps, including their full paths, so something like
/Applications/Mactracker.app
/Applications/Xcode.app
/Applications/Pages.app
/Applications/Numbers.app
/Applications/Keynote.app
/Applications/Apple Configurator.app
/Applications/iPhoto.app
/Applications/iMovie.app
/Applications/Evernote.app
/Applications/Memory Clean.app
/Applications/Install 10.12 Developer Preview.app
/Applications/TextWrangler.app
Does that help?
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
