Rich's distinction is still the right one: an app installed from the Mac App Store has a receipt. An app installed from Xcode, TestFlight, or another sandbox path often does not. exit(173) was a way to ask the system to write a temporary receipt, and as macOS evolved it became fragile, which is what you were hitting in 2022. That API is now deprecated, so new code should not depend on it.
On macOS 13 and later, replace the launch-time exit(173) path with StoreKit 2:
import StoreKit
func hasVerifiedAppTransaction() async -> Bool {
do {
let result = try await AppTransaction.shared
if case .verified = result {
return true
}
return false
} catch {
return false
}
}
If the transaction is missing or unverified, do not quit with 173. Follow Rich's advice for the sandbox: treat a missing receipt as "no premium entitlement yet," and use Restore Purchases (or a later successful transaction) when you need a receipt to inspect. Forcing a refresh dialog at launch is a bad experience for Review and for customers.
Two limits are worth stating plainly, because this thread also talks about using the receipt to prove a "legit" App Store install:
- A valid receipt, or a
.verified AppTransaction, means Apple signed a purchase record for this bundle. A copied Mac App Store build can still carry that receipt, so this is a weak test for redistribution. - The check runs on the user's Mac. Anyone who can patch a binary can skip the receipt check, the same way they can skip a license flag. App Attest (
DCAppAttestService) can add an attestation signal on supported macOS versions for a full app running in a user session, but it is not a stand-in for "this build cannot be patched," and it is not available in the same way for daemons or system extensions.
If you still support macOS versions before AppTransaction, keep on-device receipt validation for those versions, fail soft when the receipt is absent, and feature-detect AppTransaction at runtime on newer systems. Compare bundle identifiers against values in your code, not against Info.plist values that a modified bundle could edit.
A local receipt or transaction check can be patched. Use it to decide entitlements for honest customers, including people who are offline or who restored from a local backup, and do not treat it as copy protection.
I wrote about local checks and their limits here: https://fortifie.xyz/blog/stop-mac-app-cracking
I work on Fortifie, which makes a Mac hardening tool.