How to run AppleScript (.scpt) as LaucnDaemon by root
Assuming your launchd job is correctly set-up, you may be reaching a limitation of AppleScript.

AppleScript Requires a GUI (Aqua Session)

If your AppleScript is launched using launchd as a user root process, it will not have a graphical user interface associated. The majority of AppleScript requires a graphic user interface to work consistently. Depending on the version of OS X, it may work, but it is not designed to.

Processes on OS X can not trivially cross between user sessions.

Do Shell Script

A more robust approach is to separate out the functionality needing higher privileges into a shell script such as bash, perl, ruby, or python.

Your AppleScript can then call that script using AppleScript's do shell script:

do shell script "command" user name "me" password "mypassword" with administrator privileges


If you need to avoid embedding a username and password, this is possible but beyond the scope of this question.