title: How to start UI from OSX daemon or agent with root
body: <p>I'm looking for a way to have my program started when user logins or when system boots up. The program needs to have root privilege and it needs to display some UI stuff on the top menu bar.</p>
  
  <p>I have tried using launchd to start it as daemon and agents. The problem is daemons can't have UI. And agents are run as the user so it doesn't have root privilege. </p>
  
  <p>I also tried having a daemon to call a script using setsid() to have my program running in a different process group but that didn't help either. It just can't show any UI stuff.</p>
  
  <p>I am new to OSX and really need some help about this. </p>