How to attach to Privileged Helper as root?

We have a Privileged Helper tool that we install with SMJobBless. I would like to debug it.

I've added WaitForDebugger in our helper tool launchd plist and it does wait. But I can't attach to it via Debug->Attach to Process in Xcode with error:

Code: 3 Failure Reason: tried to attach to process as user 'myusername' and process is running as user 'root'

I set Debug process as: root in scheme settings. But I'm not sure if it does anything since I'm not running this particular scheme at the moment of attach.

I tried unsuccessfully to set "Wait for the executable to be launched" but I had to create a new scheme for it since helper is built as part of the main app so maybe I did something wrong.

Am I doing something wrong or is it not possible to attach to root process?

Answered by DTS Engineer in 792675022

Choose Debug > Attach to Process by PID or Name and then select Debug Process As > root.

ps Not that it’s related to this issue, but SMAppService is a lot nicer than SMJobBless. If you can afford to raise your deployment target, I encourage you to explore that option.

Share and Enjoy

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

Choose Debug > Attach to Process by PID or Name and then select Debug Process As > root.

ps Not that it’s related to this issue, but SMAppService is a lot nicer than SMJobBless. If you can afford to raise your deployment target, I encourage you to explore that option.

Share and Enjoy

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

How to attach to Privileged Helper as root?
 
 
Q