kent
kent

Reputation: 6576

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

Upvotes: 9

Views: 12067

Answers (3)

Thomas Zoechling
Thomas Zoechling

Reputation: 34253

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

Upvotes: 12

Frank
Frank

Reputation: 2413

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"

Upvotes: 21

Greg Hewgill
Greg Hewgill

Reputation: 993333

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.

Upvotes: 1

Related Questions