Apple Silicon app builds but cannot launch

The new M1 Mac Mini is great, and I've had some success compiling various projects natively. However, I encountered an issue I'm not sure how to resolve.

In Xcode, the app builds but fails to run with the following dialog of cryptic errors:

Code Block text
Could not launch
Domain: IDELaunchErrorDomain
Code: 20
Recovery Suggestion: The LaunchServices launcher has return an error. Please check the system logs for the underlying cause of the error.
User Info: {
    DVTRadarComponentKey = 113722;
}
--
The operation couldn’t be completed. (OSStatus error -10826.)
Domain: NSOSStatusErrorDomain
Code: -10826
User Info: {
    "_LSFunction" = "_LSLaunchWithRunningboard";
    "_LSLine" = 2508;
}
--
The operation couldn’t be completed. Launched process exited during launch.
Domain: RBSRequestErrorDomain
Code: 5
Failure Reason: Launched process exited during launch.


Finder complains about permission when launching, and the Console reports this message:

Code Block text
Unable to obtain a task name port right for pid 2071: (os/kern) failure (0x5)


I thought it could be a signing issue and have tried automatic, manual, codesign and every option I can find for the app and associated libraries. I've tried this in Xcode 12.2 and the 12.3 Beta and haven't been able to find any helpful answers online.

I'm not sure what to try next. Anyone have more insight into these error messages or at least another place I can look to find details?

Thanks 🙂
Post marked as unsolved Up vote post of Elyus Down vote post of Elyus
134 views

3 Replies

I had this same problem, and I was able to fix it by turning on "Automatically manage signing" in my target settings.
Unfortunately, I'm still getting the same error even after checking automatic signing. I've also confirmed the resulting binary and any embedded libraries are all signed with codesign, but I continue to see the permission complaint in Finder and the launch error in Xcode.

I don't have any good ideas where to look next to identify the problem. I was hoping the launch error would propagate some more meaningful reports somewhere, but I haven't found any. Without being able to run, debugging is quite tricky, so maybe the only option is to strip out code to see if it reaches a point of being able to run, although I'm not sure that will help. I have the distinct sense it's something else (probably a tiny thing), just can't put my finger on it.
I have this same problem