title: Writing a privileged helper tool with SMJobBless()
body: <p>Even though the API has been open since Mac OS X Leopard, there's surprisingly, and unfortunately, very little documentation on how to correctly use <code>SMJobBless()</code> for creating privileged helper tools. There are a lot of gotchas, even when copying code directly from Apple's sample project. Luckily, I've found my way around this, and have gotten the basis for my helper tool working.</p>
  
  <p>However, it would seem that <code>SMJobBless()</code> only blesses the tool and copies it over, but doesn't run it. I've included code in my helper tool's <code>main()</code> function that <em>should</em> run, but doesn't (since <code>NSLog()</code> inexplicably doesn't work–according to the tiny bit of information I <em>have</em> found–I've tried <code>syslog()</code>ing some "Hello world" type strings, but nothing appears on the system console). There's no indication that the helper tool is launched at all.<br>
  The documentation is mostly useless. It simply says that after <code>SMJobBless()</code> is called, the helper tool is 'ready', with no indication of what 'ready' even means.</p>
  
  <p>Furthermore, Apple's sample doesn't include any interprocess communication code, and doesn't explain how one is supposed to interact with the helper tool. Do you use Distributed Objects? Mach ports? Who knows? There's no official word on how to do it.</p>
  
  <p>So, does anyone have any information on how to get this done? I've confirmed that the helper tool is installed, and authentication works, but I simply can't figure out how to launch the helper tool and communicate with it - there's simply such a gap in the documentation that this is a mystery for now. It's very frustrating; I can't be the <em>only</em> one with this problem (but there's little mention of it <em>anywhere</em>), and <code>SMJobBless()</code> obviously works <em>somehow</em>, since it's what Apple uses.</p>
  
  <p>(Please don't mention <code>AuthorizationExecuteWithPrivileges()</code>. I'm not using it: it's deprecated, sure to go away, and is a major security hole. No thanks.)</p>