How to set my application to always run as root OSX

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.