This project contains a demo, and a reuseable library of Cocoa code, which allows Cocoa applications to perform privileged tasks using a Privileged Helper Tool. It does this via a slightly updated/hacked version of Apple's BetterAuthorizationSample code. The update/hack is that is uses the Service Management API, SMJobBless() in particular, instead of AuthorizationExecuteWithPrivileges. It therefore requires Mac OS X 10.6.
If your app requires Mac OS 10.7, you should read this overview which has a better solution, using XPC.
Are you sandboxed? CocoaPrivilegedTasks uses the Authorization Services framework, in whose documentation it is now stated that the authorization services API is not supported within an app sandbox because it allows privilege escalation. In other words, don't use this code if you are sandboxed.
Are you still supporting Mac OS X 10.5? For applications still supporting Mac OS X 10.5, you must use older code such as AuthorizedTasksInCocoa.
Visit this project's GitHub Repository to download, fetch, or clone this code.