Notarization wipes the "Icon?" file

In an AppleScript applet, compiling and exporting in Script Editor replaces a custom icon with the default. To retain a custom icon, it is necessary, after exporting, to use Finder's "Get info..." to copy the icon from another file and paste into the icon for the applet. The custom icon is stored in the "Icon?" file, located in the root of the applet bundle. The applet can then be signed and notarized.

With macOS Tahoe, that procedure no longer works. That is because the notarization process now wipes the "Icon?" file. The file remains in place but has zero size. Thus Finder shows the default applet icon.

Does anyone know of a way to provide a custom icon for a signed and notarized AppleScript applet ?

The Get Info procedure is a way to set an icon to something different than is already there.

The normal way to set an icon is to include the icon file in the Resources folder of the application bundle and edit the name in the Info.plist CFBundleIconFile entry. If using Xcode, it has various options to generate and include the icon as part of the build process.

Hi red_menace, Happy New Year.

I don't think it's possible to use Xcode to prepare AppleScript applets – I can find no documentation on how. Have tried wandering/stumbling around in Xcode looking for a way. Nothing found so far.

As mentioned, Script Editor does not respect a custom icon. It's had that bug for many years. Recently, with the macOS 26 release, Script Debugger was hit with the same bug (I believe SD always uses the latest AppleScript binary which I think is partly the cause). I assume that Xcode even if it can be used for exporting AppleScript applets will have the same bug.

Just to be clear, even if a custom icon file is created with the default name, it is ignored and the default icon is shown on the Finder Desktop.

Since my first post I've found that the "Get Info..." method works if done after notarization. In my testing, the applet when downloaded with Safari still runs. This suggests that code signing does not take into account such a change to data stored in the bundle's root folder. Need to do more testing.

I'm hesitant to update to Tahoe and Xcode 16, but at least in Xcode 15, you can still add the AppleScriptObjC project templates that Apple removed. I just threw that in there since Xcode has various editors and does a lot of that kind of stuff for you. Get Info stores the icon in the Icon\r file at the root level for a folder, which would be outside the application Contents folder and code signed bits.

Script Debugger isn't quite as bad, but the script editors have pretty much always made their own tweaks to the bundle settings when saving as an app, so you should always manually go through the final build and double-check that the assets and Info.plist are set the way you want, including removing the default icon file. I haven't had any problems setting custom icons that way.

I agree with red_menace that you don’t want to be using a custom icon for this. That’s super brittle.

If you using Script Editor to save a new application, it has already set up all the bits you need:

% plutil -p Test811273.app/Contents/Info.plist 
{
  …
  "CFBundleIconFile" => "applet"
  "CFBundleIconName" => "applet"
  …
}
% file Test811273.app/Contents/Resources/applet.icns 
Test811273.app/Contents/Resources/applet.icns: Mac OS X icon…
% file Test811273.app/Contents/Resources/Assets.car
Test811273.app/Contents/Resources/Assets.car: Mac OS X bill of materials (BOM) file

To get the right icon, replace applet.icns with your own:

% cp /Applications/Pages.app/Contents/Resources/AppIcon.icns Test811273.app/Contents/Resources/applet.icns
% rm Test811273.app/Contents/Resources/Assets.car

After doing this, zip and unzip the app so that the Finder refreshes.

Now, in this case I nixed the Assets.car entirely, so that macOS falls back to applet.icns. A better way to do it would be to use Xcode to build a dummy app with the right icon and then copy the built assets over from that.

IMPORTANT Modifying the applet breaks the seal on its code signature, so you’ll have to re-sign it. But you have to do that anyway in order to sign it with your Developer ID so that you can notarise it.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hello Quinn, many thanks for all this.

Normally I use Script Debugger to export my applet run-only. Then, I use SD Notary to sign and notarize. I will try to put your suggestion into that workflow. Up until Tahoe, I was avoiding Script Editor partly because it ignored/wiped my custom icon no matter what I tried. SD, did not.

I don't know how to use Xcode. Have tried a few times but found it impenetrable. It will take me some time to get it working even to just create a dummy app with a custom icon.

Cheers.

Notarization wipes the "Icon?" file
 
 
Q