Block stripping of com.apple.security.get-task-allow

Trying to profile my mac app with instruments. I am not able to start with "Allocations" or "Leaks", I'm asked for my admin password and then immediately seeing an error in the log: "Failed to attach to target: Failed to attach to target process." "Time Profiler" seems to work ok.

Changed the build configuration for profiling to "Debug" in the scheme seemed to help and after some digging I found out this is happening because the debug build has com.apple.security.get-task-allow entitlement while the release build doesn't. Great, so I've added this entitlement to the entitlement file but still no go, checked the signature and saw that com.apple.security.get-task-allow was removed. Did some more digging and read somewhere that you need to set CODE SIGN INJECT BASE ENTITLEMENTS to NO. Did that but still no luck.
Does anyone have any idea how to prevent Xcode from stripping this entitlement in the release build? I really want to profile my app using a release build.

Answered by DTS Engineer in 622608022
Do you have the Deployment Postprocessing build setting (DEPLOYMENT_POSTPROCESSING) set?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Normally the get-task-allow entitlements are only stripped when you distribute your app from the Organizer. If you create a new project in Xcode and choose Product > Profile, Xcode will create a Release build with the get-task-allow entitlement (I just confirmed that here in my office, using Xcode 11.5). I recommend that you try that at your end, just to make sure we’re on the same page.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Thanks for your reply. With a new project it does add the get-task-allow (that is com.apple.security.get-task-allow) but my project is an old and crusty project (17 years) so I guess something there is causing this not be added automatically and even removed if I add it manually.
Accepted Answer
Do you have the Deployment Postprocessing build setting (DEPLOYMENT_POSTPROCESSING) set?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Yes, it was set to YES for release and NO for debug. I set it to NO for release and now I can profile. Thanks!
Block stripping of com.apple.security.get-task-allow
 
 
Q