Reputation: 3512
I am developing an OSX application that some features of it requires ROOT privileges I figured out how to debug my app as root (simply in schemes).
But I want users to run it as Root so they will have access to its features.
How can I do this??
Upvotes: 9
Views: 27376
Reputation: 1012
You can create a local server and keep it running in /Library/LaunchDaemons. This will let the server auto startup and gain the root privilege. I found a good article talking about this.
Upvotes: 1
Reputation:
Do not run desktop applications as root. The Mac OS X frameworks are not intended to be used this way, and undesirable behavior will result (e.g, files/folders owned by root in the user's Library; process not responsive to "force quit"; potential security vulnerabilities).
Use Authorization Services to run specific, limited privileged operations as root.
Upvotes: 3
Reputation: 2195
If it's a typical OS X application bundle, you can run it as root in the Terminal with:
sudo /Applications/YourAppName.app/Contents/MacOS/YourAppName
You could save a file containing just this, and name it YourAppLauncher.command, and it would be double-clickable from the Finder.
Or, in AppleScript:
do shell script "/Applications/YourAppName.app/Contents/MacOS/YourAppName" ¬
with administrator privileges user name "username" password "password"
Then save that as an Application to launch your app as root. It won't prompt for a password (if you want it to, remove everything after with administrator privileges.
Upvotes: 5