title: Start/Assign macOS app with root privileges
body: <p>I have written a macOS Cocoa app using XCode 9.2.</p>
  
  <p>The purpose of the app is as a wrapper to a set of shell commands so that users can run commands easily as required. The shell script allow the users to control a particular device driver for which the software is written by another party.</p>
  
  <p>I have managed to get the app to invoke the shell command as root.</p>
  
  <p>But there are some sub-commands that fail. The actual commands run are, and I think it is the 2nd "<code>stop -a</code>" that fails:</p>
  
  <pre><code>do shell script \"
  cd '/Library/Application Support/ABC' ;
   python '/Library/Application Support/ABC/abc.py' stop -d;
   python  '/Library/Application Support/ABC/abc.py' stop -a;
   python '/Library/Application Support/ABC/abc.py' stop -g;
   python '/Library/Application Support/ABC/abc.py' stop -t;\"
   with administrator privileges
  </code></pre>
  
  <p>When I run the same commands in Terminal they work, either as discrete commands or in a shell script. </p>
  
  <p>As a last resort I ran the app from the command line using </p>
  
  <pre><code>sudo ~/Library/Developer/Xcode/DerivedData/appname/Build/Products/Debug/appname.app/Contents/MacOS/appname
  </code></pre>
  
  <p>And this works perfectly.</p>
  
  <p>So, it seems that when I run using the NSAppleScript framework, which correctly prompts me for the root password, there is still something amiss which causes the command failure. But when the whole app runs under <code>sudo</code> everything works.</p>
  
  <p>So the solution appears to be to set the app to require Root privs. Is there a setting that can be set for the built project that would automatically set this such that the root password is requested on startup?</p>