STPrivilegedTask

UPDATE 2012: This class now has a home on GitHub. Go there to view and download the latest version. If you fork and improve it, please push your improvements back. Thank you!


STPrivilegedTask is an Objective C class. It is an NSTask-like wrapper around the AuthorizationExecuteWithPrivileges() function from Apple's Security API.

I have no documentation prepared for this class at the moment, but it should be fairly obvious if you're familiar with NSTask. You can peruse the code at your leisure and use it as you please under a BSD license.

Due to limitations in Apple's Security framework, task termination is not supported, nor is it possible to get PID for the task or stderr output. stdout piping works just as you would expect it would in NSTask.


Class files