I'm trying to staple a validation ticket to an exe file that is already notarized. The process ended with the following error:
Downloaded ticket has been stored at file:///var/folders/bj/ry08v0694972s03cswkq5md80000gq/T/7f1a34f0-8628-4157-92b0-b59cebe70951.ticket. Could not remove existing ticket from file:///Users/efi-admin/Downloads/ActualSignedFile/Contents/CodeResources because an error occurred. Error Domain=NSCocoaErrorDomain Code=512 "“CodeResources” couldn’t be removed." UserInfo={NSUserStringVariant=( Remove ), NSFilePath=/Users/efi-admin/Downloads/ActualSignedFile/Contents/CodeResources, NSUnderlyingError=0x600000151e90 {Error Domain=NSPOSIXErrorDomain Code=20 "Not a directory"}} The staple and validate action failed! Error 73.
The above was captured using the verbose option of the cmd...
Among the response, I can see the ticket: fields = { signedTicket = { type = BYTES; value = "czhjaAEAAADxBQAALQAAADCCBe0wggL/MIICpKADAgECAghWLFU2G59vVTAKBggqhkjOPQQDAjByMSYwJAYDVQQDDB1BcHBsZSBTeXN0ZW0gSW50ZWdyYXRpb24gQ0EgNDEmMCQGA1UE.... (partial)
I need help to properly understand what is this cmd doing as the issue might be permissions one.
The path mentioned above under /ActualSignedFile:
/ActualSignedFile/Contents/CodeResources
Does not exist. Is that the cmd wants to create it?
Is there any way to manually attach the ticket to the file, given the fact that is printed in verbose mode?
Thanks!
Any help will he highly appreciated!
First up, I strongly recommend that you not use your Downloads folder for day-to-day work. Downloads is protected by MAC, and that can cause all sorts of weird problems. See On File System Permissions for more about MAC.
Having said that, that doesn’t appear to be the cause of this issue. You wrote:
I'm trying to staple a validation ticket to an exe file that is already notarized.
I presume that this is a command-line tool, that is, a single standalone executable. If so, you won’t be able to staple a ticket to it. Stapling only works for bundled code (typically apps), installer packages, and disk images.
Stapling is not an absolute requirement, so you could just skip this step. See The Pros and Cons of Stapling for more about that.
In most cases, however, you can staple your ticket by adopting the right packaging format. Mac users expect to receive their software in one of three containers: zip, disk image, or installer package. Two out of three of those support stapling. So, my advice is that you package your tool into a container that supports stapling, notarise that container, and then staple that.
For detailed advice, see Packaging Mac Software for Distribution.
One last note: Some users attempt to run command-line tools by double clicking them in the Finder. Doing this triggers a Gatekeeper bug; see the Tool Blocked by Gatekeeper section of Resolving Gatekeeper Problems. If you think your users are likely to do this, you can avoid this bug by distributing your tool in an installer package.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"