In the LightweightCodeRequirements framework, there is a LaunchCodeRequirement object which can be used as a requirement object for a Process for example.
What I don't understand (I admit my macOS low-level knowledge is limited) is that how can this be used in a secure way that doesn't fall victim of a Time-of-Check/Time-of-Use issue.
e.g.
I specify a LaunchCodeRequirement via Process.launchRequirement for my process, let's say /usr/local/bin/mycommandlinetool.
The LaunchCodeRequirement specifies my development team and a developer ID certificate.
The process must be started in some form, before a SecCode/SecTask object can be created, rather than a SecStaticCode object (which only guarantees its validity checks to be intact as long as the file is not modified).
But if the process was started, then I have no tools in my set to prevent it from executing its initialization code or similar. Then, by the time I'm able to check via SecCode/SecTask functions the LaunchCodeRequirement, I might have already ran malicious code - if mycommandlinetool was maliciously replaced.
Or does the operating system use a daemon to copy the executable specified for Process to a secure location, then creates the SecStaticCode object, assesses the LaunchCodeRequirement and if passed, launches the executable from that trusted location (which would make sure it is immutable for replacement by malicious actors)?
I have a hard time understanding how this works under the hood - if I remember correctly these are private APIs.
General
RSS for tagDemystify code signing and its importance in app development. Get help troubleshooting code signing issues and ensure your app is properly signed for distribution.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Created
In Swift I'm using unzip by launching a Process to unzip a file.
I added a launchRequirement to the process in order to make sure the executable is code signed by Apple and the identifier is com.apple.unzip. After testing out my code on another machines (both physical and virtual), I found out that in some the identifier is actually com.apple.zipinfo, which broke the SigningIdentifier requirement.
It's safe to assume that /usr/bin/unzip can be trusted since it's in a System Integrity Protection (SIP) location, but I'm wondering why this executable has different identifiers?
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.
Topic:
Code Signing
SubTopic:
General
Our app .dmg file was successfully code signed. We then revised the app and created a new .dmg.
Running codesign gave an "app is already signed" message. Then running codesign -dv said "code object is not signed at all"
Older solutions said to use -f to force signing, but that is no longer an option.
Hello,
I have a macOS app built with Flutter’s macOS target (native Xcode project). The app is unsigned (no Developer ID code signing / notarization). The .app bundle looks valid:
CFBundlePackageType = APPL
Unique CFBundleIdentifier
No LSUIElement or LSBackgroundOnly
Executable exists and is runnable
Placed at /Applications/MyApp.app (top-level), runs fine from Finder
However, it does not show up in Launchpad.
What I tried:
Remove quarantine:
xattr -dr com.apple.quarantine "/Applications/MyApp.app"
Force Launch Services registration:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f "/Applications/MyApp.app"
Rebuild LS caches:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
Reset Launchpad DB and restart Dock:
defaults write com.apple.dock ResetLaunchPad -bool true && killall Dock
Verified bundle structure/type:
mdls -name kMDItemContentType -name kMDItemKind "/Applications/MyApp.app" → shows com.apple.application-bundle / Application
Questions
Is code signing/notarization required for an app to appear in Launchpad (even if it runs from Finder)?
What additional conditions cause Launchpad to skip an otherwise valid, unsigned .app in /Applications?
Are there deeper Launch Services or Dock database checks I can run to diagnose why this specific app is excluded?
I added a watchkit extension to an existing app.
I get this error when uploading to App Store Connect. Building the archive itself is fine:
Prepared archive for uploading
Upload failed
error: Validation failed
Missing Info.plist value.
A value for the key “WKApplication”, or “WKWatchKitApp” if your project has a WatchKit App Extension target, is required in “Runner.app/Watch/watch_Watch_App.app” bundle.
For details, see: https://developer.apple.com/documentation/watchkit/creating_independent_watchos_apps/setting_up_a_watchos_project
have the exact same issue when bundling. I added the flag manually in a additional plist fields entry with WKApplication=1 because my Info.Plist is generated and it didn't help. I wrote a custom Run Script Phase that added the flag and that didn't help as well.
I need a reply from someone from Apple here. This needs to be fixed.
Hi guys,
Is there any good up-to-date tutorial about publishing a Python based app on Apple Store?
Now, I have developed a standalone Python app from PyCharm, and it's using Pyside6 for UI and some major Python libraries. It's a productivity app with a little A.I. features. I used PyInstaller to prepare the app. Currently, I am stuck at the stage of codesign and Apple Review process, because I am manually doing codesign and building the package from command-line. Without using Xcode, things can get messy or miss easily.
It would be nice to follow a up-to-date tutorial about how to complete the codesign and Apple Review process for a Python based app. For example, what to do, how to do, what to be careful during the Apple Review process, etc. Thanks!
I regularly see questions from folks who’ve run into code-signing problems with their third-party IDE. There’s a limit to how much I can help you with such problems. This post explains a simple test you can run to determine what side of that limit you’re on.
If you have any questions or comments, please put them in a new thread here on DevForums. Put it in Code Signing > General topic area and apply whatever tags make sense for your specific situation.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
Investigating Third-Party IDE Code-Signing Problems
DTS doesn’t support third-party tools. If you’re using third-party tooling and encounter a code-signing problem, run this test to determine whether you should seek help from Apple or from your tool’s vendor.
IMPORTANT Some third-party tools create Xcode projects that you then build and run in Xcode. While that approach is understandable, it’s not something that DTS supports. So, the steps below make sense even if you’re already using Xcode.
To check that code-signing is working in general:
Launch Xcode.
In Xcode > Settings > Accounts, make sure you’re signed in with your developer account.
Create a new project from the app project template for your target platform. For example, if you’re targeting iOS, use the iOS > App project template.
When creating the project:
Select the appropriate team in the Team popup.
Choose a bundle ID that’s not the same as your main app’s bundle ID.
Choose whatever language and interface you want. Your language and interface choices are irrelevant to code signing.
Choose None for your testing system and storage model. This simplifies your project setup.
In the Signing & Capabilities editor, make sure that:
"Automatically manage signing” is checked.
The Team popup and Bundle Identifier fields match the value you chose in the previous step.
Select a simulator as the run destination.
Choose Product > Build. This should always work because the simulator doesn’t use code signing [1]. However, doing this step is important because it confirms that your project is working general.
Select your target device as the run destination.
Choose Product > Build.
Then Product > Run.
If you continue to have problems, that’s something that Apple folks can help you with. If this works, there’s a second diagnostic test:
Repeat steps 1 through 10 above, except this time, in step 4, choose a bundle ID that is the same as your main app’s bundle ID.
If this works then your issue is not on the Apple side of the fence, and you should escalate it via the support channel for the third-party tools you’re using.
On the other hand, if this fails, that’s something we can help you with. I recommend that you first try to fix the issue yourself. For links to relevant resources, see Code Signing Resources. You should also search the forums, because we’ve helped a lot of folks with a lot of code-signing issues over the years.
If you’re unable to resolve the issue yourself, feel free to start a thread here in the forums. Put it in Code Signing > General topic area and apply whatever tags make sense for your specific situation.
Topic:
Code Signing
SubTopic:
General
We have an app which is hybrid using React Native and Native features. We released our app recently which showed issues related to missing packages/corrupt package but xCode didn't gave any error and we were able to Archive and submit app successfully.
Topic:
Code Signing
SubTopic:
General
To validate incoming XPC connections from other executables, we perform SecCode checks for the dynamic signature of the connection (kSecCSDynamicInformation).
Reading the setCodeSigningRequirement(_:) function documentation it appears to perform only static signing checks, is that so?
If we use setCodeSigningRequirement(:) function in our listener(:, shouldAcceptNewConnection:) do we still need to check the dynamic information to be properly secure?
Hello Apple Developer Support Community,
I am encountering a persistent issue while trying to code sign my macOS application (PromptVault.app) using a valid Developer ID Application certificate. The signing process fails with the following warning and error for every native .so file inside the app bundle:
`Warning: unable to build chain to self-signed root for signer "(null)"
<file-path>: errSecInternalComponent`
What I have tried so far:
Verified that my Developer ID Application certificate and the associated private key exist correctly in the login keychain.
Confirmed that the intermediate certificate "Apple Worldwide Developer Relations - G6" is installed and valid in the System keychain.
Added Terminal to Full Disk Access in Security & Privacy to ensure signing tools have required permissions.
Executed security set-key-partition-list to explicitly allow code signing tools to access the private key.
Reinstalled both developer and Apple intermediate certificates.
Used codesign to individually sign .so files and then sign the entire bundle.
Ensured macOS and Xcode Command Line Tools are up to date.
Created a clean Python virtual environment and rebuilt all dependencies.
Tested code signing in multiple ways and with verbose logging.
Current status:
Despite all these efforts, the same warning and error persist during the signing process of every .so file. This prevents successful code signing and notarization, blocking distribution.
Request for assistance:
Could anyone confirm if my certificate and keychain setup sounds correct?
Are there known issues or extra steps necessary to properly build the trust chain for Developer ID certificates on macOS 15.6.1 (Sequoia)?
Any suggestions for resolving the errSecInternalComponent during signing native libraries?
Guidance on ensuring the entire certificates chain is trusted and usable by codesign tools?
I can provide debug logs, screenshots of my keychain and security settings, or any other diagnostic information if needed.
Thanks in advance for your help!
Your development team has reached the maximum number of registered iPhone devices.
I am use the free provisioning file.
So how can I delete old device and use my new iPhone to develop my app.
only way is use a paid account?
or register a new Apple ID?
Topic:
Code Signing
SubTopic:
General
I was working in Xcode with a free personal Team ID. I upgraded to the Dev Program and now have a paid Team ID. I used the same Apple ID for both. The paid Team ID shows up in developer.apple.com as associated with my Apple ID. However, Xcode is not using the paid Team ID in signing, it's stuck on my old personal Team ID. In addition, I'm getting provisioning errors (0xe8008015) when we try to run our app on an iPhone.
Anyone have any thoughts? I've scoured the forums and ChatGPT'd, Cursor'd, etc...all of the suggested fixes do not work. This almost seems like Apple needs to make my Apple ID associated with the paid Team ID or something, to start.
Thanks all.
Topic:
Code Signing
SubTopic:
General
We have an application which keeps throwing the error "application is damaged and cannot be opened. You should move it to Trash"
I have already referred to the documentation: https://developer.apple.com/forums/thread/706379 and https://developer.apple.com/forums/thread/706442
I have checked the following possible root causes:
Codesign of the application using the codesign command
Notarization of the application using the spctl command
Executable permissions
Checked for the presence of "com.apple.quarantine" flag for the application using xattr -l <path to executables"
Checked the bundle structure
None of the above listed items seemed to be a problem and are as expected.
Can you please help us understand what could cause this issue and how to resolve this without recommending an uninstall/reinstall of the application?
I am experiencing a persistent issue when trying to sign my application, PhotoKiosk.app, using codesign. The process consistently fails with the error errSecInternalComponent, and my troubleshooting indicates the problem is with how the system accesses or validates my certificate's trust chain, rather than the certificate itself.
Error Details and Configuration:
codesign command executed:
codesign --force --verbose --options=runtime --entitlements /Users/sergiomordente/Documents/ProjetosPhotocolor/PhotoKiosk-4M/entitlements.plist --sign "Developer ID Application: Sérgio Mordente (G75SJ6S9NC)" /Users/sergiomordente/Documents/ProjetosPhotocolor/PhotoKiosk-4M/dist/PhotoKiosk.app
Error message received:
Warning: unable to build chain to self-signed root for signer "(null)"
/Users/sergiomordente/Documents/ProjetosPhotocolor/PhotoKiosk-4M/dist/PhotoKiosk.app: errSecInternalComponent
Diagnostic Tests and Verifications Performed:
Code Signing Identity Validation:
I ran the command security find-identity -v -p codesigning, which successfully confirmed the presence and validity of my certificate in the Keychain.
The command output correctly lists my identity:
D8FB11D4C14FEC9BF17E699E833B23980AF7E64F "Developer ID Application: Sérgio Mordente (G75SJ6S9NC)"
This suggests that the certificate and its associated private key are present and functional for the system.
Keychain Certificate Verification:
The "Apple Root CA - G3 Root" certificate is present in the System Roots keychain.
The "Apple Worldwide Developer Relations Certification Authority (G6)" certificate is present and shown as valid.
The trust setting for my "Developer ID Application" certificate is set to "Use System Defaults".
Attempted Certificate Export via security:
To further diagnose the problem, I attempted to export the certificate using the security find-certificate command with the exact name of my identity.
Command executed (using double quotes):
security find-certificate -c -p "Developer ID Application: Sérgio Mordente (G75SJ6S9NC)" > mycert.pem
Error message:
security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
The same error occurred when I tried with single quotes.
This result is contradictory to the output of find-identity, which successfully located the certificate. This suggests an internal inconsistency in the Keychain database, where the certificate is recognized as a valid signing identity but cannot be located via a simple certificate search.
Additional Troubleshooting Attempts:
I have already recreated the "Developer ID Application" certificate 4 times (I am at the limit of 5), and the issue persists with all of them.
The application has been rebuilt, and the codesign command was run on a clean binary.
Conclusion:
The problem appears to be an internal macOS failure to build the trust chain for the certificate, as indicated by the errSecInternalComponent error. Although the certificate is present and recognized as a valid signing identity by find-identity, the codesign tool cannot complete the signature. The failure to find the certificate with find-certificate further supports the suspicion of an inconsistency within the keychain system that goes beyond a simple certificate configuration issue.
I would appreciate any guidance on how to resolve this, especially given that I am at my developer certificate limit and cannot simply generate a new one.
Can you please help us with the scenario below, including details and Apple’s recommendations?
I've already read through the Notarization and Gatekeeper documentation.
The installed version of our application is 1.2.3, located in /Applications/XYZSecurity.app.
We created an upgrade package for version 1.2.4. As part of the pre-install script in the 1.2.4 installer, we explicitly deleted some obsolete .dylib files from /Applications/XYZSecurity.app/Contents/Frameworks and some executable files from
/Applications/XYZSecurity.app/Contents/MacOS that were no longer needed in version 1.2.4.
The installation of version 1.2.4 completed successfully, but we see the below error logs in installer.log:
PackageKit: Failed to unlinkat file reference /Applications/XYZSecurity.app/Contents/Frameworks/libhelper.dylib
PackageKit: Failed to unlinkat file reference /Applications/XYZSecurity.app/Contents/MacOS/helper-tool
Our Key Questions:
Is it the right practice to remove obsolete files in the pre-install script during an upgrade?
Is this approach recommended by Apple?
Can this cause any issues with Apple Gatekeeper? Is there a possibility of my application getting blocked by Gatekeeper as a result?
Hi,
This is my first time developing for iPhone, and I believe I have encountered an unusual edge case related to user management.
Background:
I work at a very small company currently in the proof-of-concept stage of building an iOS app. We created an Apple account under the company name: Green Vibe, using our corporate email. Initially, I developed the app under the free account on my local iPhone, and everything worked smoothly.
When NFC functionality became necessary, we upgraded to a paid Apple Developer account. At that point, I enrolled as a developer under my personal name (Or Itach) while logged in with the Green Vibe Apple account. I want to emphasize that only one Apple account was created — the Green Vibe account.
The Issue:
When attempting to add NFC, I was able to create the required certificate under the name Or Itach. However, when compiling the project, Xcode prompts me to enter the login password for the user Or Itach. This is problematic because there is no Apple ID associated with that name — only the Apple Developer enrollment under Green Vibe exists.
Request:
Could you please advise on the proper way to resolve this situation? Specifically:
Should the developer enrollment be tied directly to the Green Vibe account rather than to an individual name?
How can I correctly configure the account so that Xcode no longer requires a nonexistent Apple ID password?
Thank you very much for your support and clarification.
Topic:
Code Signing
SubTopic:
General
I've recently upgraded to the RC candidates of macOS 26 and Xcode 26. The app I'm building has a helper tool using SMAppService. When I run the app and helper tool in macOS 15 or macOS 26, all works as expected. When it runs on macOS 13 or 14, which previously worked. The helper now crashes on launch with the following reason:
Termination Reason: CODESIGNING 4 Launch Constraint Violation
I found this developer session which seems to address this, but the plist I've added doesn't seem to satisfy the constraint.
https://developer.apple.com/videos/play/wwdc2023/10266/
Here are the contents of my new plist:
Are there any gotchas here that I might be missing?
Thanks!