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??
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??
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.
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.
sudo
so don't tell such things like mac os x is not intended to be used in that way
... osx is unix bases OS and its normal to use root
permissions sometimes. see also (AppleSupport)[support.apple.com/en-us/HT204012]
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.
sudo
? There's a difference. I'm assuming you want to run withsudo
. Running as root means running it under the root user account.