title: Running sh script through AuthorizationExecuteWithPrivileges
body: <p>I'm running an uninstallation script through cocoa app, and I noticed that launchctl command doesn't get executed.</p>
  
  <p>This is the part of the code that calls script (which contains sudo launchctl unload "name of the daemon")</p>
  
  <pre><code>//pFileName is the name of the File
  
  NSString* pPath = [pCurrentBundle pathForResource:pFileName ofType:@"sh"];
  char* const ppArgs[] = {const_cast&lt;char*&gt;([pPath fileSystemRepresentation]), NULL};
  
  OSStatus status =  AuthorizationExecuteWithPrivileges(m_AuthorizationRef, "/bin/sh", kAuthorizationFlagDefaults, ppArgs, NULL); 
  </code></pre>
  
  <p>Since all other script commands get executed properly (and it unloads fine in terminal), I am guessing that I don't have same privilege as root (both EUID and RUID being 0) as TN2083 states.</p>