Mac App Development: "***.app" is damaged and can't be opened

Viewed 863

I have a Mac App that I didn't touch for a while. Now, it appears that something around running apps with Mac App Store integrations has changed since macOS Catalina.

When I launch the App from XCode it crashes with exit code 173 and logs as below, followed by a prompt to login with my Apple ID, which I tried both my lives as sandbox Apple ID.

enter image description here

Regardless of which Apple ID I am signing in with, it ends with an error: «"Appname" is damaged and can't be opened.»

enter image description here

Logs

Could not check for receipt presence for some reason... Error Domain=NSCocoaErrorDomain Code=260 "The file “receipt” couldn’t be opened because there is no such file." UserInfo={NSURL=Contents/_MASReceipt/receipt -- file:///Users/******/Library/Developer/Xcode/DerivedData/*********-egqjyklohxjyjqcvtxjmwzdxvxhv/Build/Products/Debug/**********.app/, NSFilePath=/Users/******/Library/Developer/Xcode/DerivedData/*********-egqjyklohxjyjqcvtxjmwzdxvxhv/Build/Products/Debug/**********.app/Contents/_MASReceipt/receipt, NSUnderlyingError=0x600000c86310 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
2021-01-08 13:23:07.867823+0100 *********s[87637:4910885] Failed fetch receipt with error: The file “receipt” couldn’t be opened because there is no such file.
Could not check for receipt presence for some reason... Error Domain=NSCocoaErrorDomain Code=260 "The file “receipt” couldn’t be opened because there is no such file." UserInfo={NSURL=Contents/_MASReceipt/receipt -- file:///Users/******/Library/Developer/Xcode/DerivedData/*********-egqjyklohxjyjqcvtxjmwzdxvxhv/Build/Products/Debug/**********.app/, NSFilePath=/Users/******/Library/Developer/Xcode/DerivedData/*********-egqjyklohxjyjqcvtxjmwzdxvxhv/Build/Products/Debug/**********.app/Contents/_MASReceipt/receipt, NSUnderlyingError=0x600000c8dd40 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
2021-01-08 13:23:07.869011+0100 *********s[87637:4910885] Failed fetch receipt with error: The file “receipt” couldn’t be opened because there is no such file.
Could not reach receipt URL: Optional(Error Domain=NSCocoaErrorDomain Code=260 "The file “receipt” couldn’t be opened because there is no such file." UserInfo={NSURL=Contents/_MASReceipt/receipt -- file:///Users/******/Library/Developer/Xcode/DerivedData/*********-egqjyklohxjyjqcvtxjmwzdxvxhv/Build/Products/Debug/**********.app/, NSFilePath=/Users/******/Library/Developer/Xcode/DerivedData/*********-egqjyklohxjyjqcvtxjmwzdxvxhv/Build/Products/Debug/**********.app/Contents/_MASReceipt/receipt, NSUnderlyingError=0x600000c8ddd0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}})
2021-01-08 13:23:07.882384+0100 *********s[87637:4910885] No receipt found! Will exit with 173 to let macOS handle renewing a receipt from the App Store.

Setup

  • macOS 10.15.7 (19H114)
  • XCode 12.3 (12C33) // also tried it with XCode 11.7 → same same
  • App signed with valid development certificate
1 Answers

You can modify the attributes via the xattr command. With that you can bypass e.g. your error message or others like when the app cannot be opened as it wasn't installed from the AppStore.

Anyhow, launch your terminal and use:

sudo xattr -cr {path_to_application}/application.app

With the xattr you're able to view the extended attributes themselves (and remove them) by applying

  1. the -c flag with which you remove all attributes
  2. and -r to act on all the files the directory tree is pointed to.

For both flags, as well as xattr, I'd suggest reading this documentation page.

Related