开发者

Xcode debugger: cmd line application - start with sudo?

I need to debug a command line application with Xcode... and I开发者_运维百科 need to have the debugger launch my app with 'sudo'. How do I tell Xcode to do that?

thx->adv


Running XCode as root is a bad idea.

There is an option for this in XCode (6.2):

  • Product -> Scheme -> Edit Scheme
  • Select the "Run" configuration
  • Change the radio button for "Debug Process As" to "root"


Have you tried starting Xcode with sudo?
The processes it spawns (gdb,...) should also run with superuser privileges:

sudo /Applications/Xcode.app/Contents/MacOS/Xcode


You could launch XCode itself with sudo, then it will be running with the privileges of your nominated user, and also your application would run with the same privileges.

This may not be the best way; there may be a way to tell XCode to launch your application in a particular way. But the above method will work in any case.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜