Xcode debugger: cmd command line application - start with sudo?

I need to debug a command line application using Xcode ... and I need a debugger to run my application using "sudo". How to tell Xcode about this?

thanks->

+8
xcode macos
source share
3 answers

Have you tried running Xcode with sudo?
The processes that it spawns (gdb, ...) must also be started with superuser privileges:

sudo /Applications/Xcode.app/Contents/MacOS/Xcode 
+9
source share

Running Xcode as root is a bad idea.

Xcode (6.2) has an option:

  • Product β†’ Scheme β†’ Edit Scheme
  • Select Startup Configuration
  • Change the "Debug process as" switch to "root"
+14
source share

You can run Xcode directly with sudo , then it will work with the privileges of your designated user, and your application will also work with the same privileges.

This may not be the best way; there might be a way to tell Xcode to launch your application in a certain way. But the above method will work anyway.

+1
source share

All Articles