I made a macOS application using Swift Package and distributed it in dmg format through Apple Notary service. However, we received a report from a user that it can be launched from a disk image mounted from dmg, but when copied to /Applications,
the app is broken and does not start.
I looked into why this happened, I noticed that the codesign
command returned different results when copying the application bundle and /Applications
on the volume mounted dmg with Finder.
Mounted dmg: OK
❯ codesign --verify --deep --verbose /Volumes/azoo-key-skkserv/azoo-key-skkserv.app
/Volumes/azoo-key-skkserv/azoo-key-skkserv.app: valid on disk
/Volumes/azoo-key-skkserv/azoo-key-skkserv.app: satisfies its Designated Requirement
Copied by Finder: Bad
codesign reports that there are 148 added/missing files.
❯ codesign --verify --deep --verbose /Applications/azoo-key-skkserv.app
/Applications/azoo-key-skkserv.app: a sealed resource is missing or invalid
file added: /Applications/azoo-key-skkserv.app/Contents/Resources/AzooKeyKanakanjiConverter_KanaKanjiConverterModuleWithDefaultDictionary.bundle/Contents/Resources/Dictionary/louds/グ1.loudstxt3
(skip...)
file missing: /Applications/azoo-key-skkserv.app/Contents/Resources/AzooKeyKanakanjiConverter_KanaKanjiConverterModuleWithDefaultDictionary.bundle/Contents/Resources/Dictionary/louds/グ1.loudstxt3
(skip...)
Copied by ditto: OK
❯ ditto /Volumes/azoo-key-skkserv/azoo-key-skkserv.app /Applications/azoo-key-skkserv.app
❯ codesign --verify --deep --verbose /Applications/azoo-key-skkserv.app
/Applications/azoo-key-skkserv.app: valid on disk
/Applications/azoo-key-skkserv.app: satisfies its Designated Requirement
I made a simple macOS application to explain this problem in an easy-to-understand way. You can download dmg in github releases, mount dmg, copy it in the Finder, and check if there is a problem by running the codesign
command.
https://github.com/mtgto/example-utf8-mac-notarization
As a result, I learned the following two things.
- Occurs only with resources with file names whose values change due to NFC/NFD normalization
- No problems occur with the resources of the application itself. Generated by the Swift Package resources that the application depends on
I think this is a problem with Finder or Gatekeeper.
I think this is a problem with Finder or Gatekeeper.
And you are correct. This is a long-standing issue with the code signing subsystem. See my explanation here.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"