How to tell if an application is from the Mac App Store

Setting up the new MacBook Pros, I needed to know this and found the following info:

Running mdls {app name} returns a lot of information, but near the top of the list are a few lines like this:
$ mdls /Applications/
kMDItemAlternateNames = (
kMDItemAppStoreAdamID = "438671026"
kMDItemAppStoreCategory = "Music"
kMDItemAppStoreCategoryType = ""
kMDItemAppStoreHasReceipt = 1
kMDItemAppStoreInstallerVersionID = "8330689"
kMDItemAppStoreIsAppleSigned = 1
kMDItemAppStorePurchaseDate = 2012-06-13 07:14:43 +0000
kMDItemAppStoreReceiptType = "ProductionReceipt"

The kMDItemAppStoreHasReceipt is what says whether or not it is a Mac App Store application, but you can see some other Mac App Store information there, such as the category (non-MAS apps have this too, interestingly), the purchase date, the application's ID, etc.

My interest in this is purely academic, but it could be useful to find all Mac App Store applications on a given Mac; you could use the kMDItemAppStoreHasReceipt key in a search, for example. If you run this in Terminal, you'll get a list of all your Mac App Store applications:

mdfind "kMDItemAppStoreHasReceipt=1"

Note that if you have any volumes excluded from Spotlight searches, their Mac App Store apps won't be listed in the results.

The original is at: Find if an application is from the Mac App Store - Mac OS X Hints

I hope this proves useful to someone else