1

There is an Apple SMJobBless example that show how to securely install a helper tool. SMJobBlessXPC is uses XPC (c API) over Mach ports for communication between the app and privileged helper tool.

I need SMJobBlessXPC by using NSXPCConnection (Objective c API).

Ahmed Lotfy
  • 3,806
  • 26
  • 28

1 Answers1

5

You're looking for the "Even Better Authorization Sample". It's a sample project showing how to set up a privileged helper using SMJobBless, and communicate with it using NSXPCConnection.

Dave DeLong
  • 242,470
  • 58
  • 448
  • 498
  • The ReadMe of SMJobBless states: "As of Snow Leopard, this is the preferred method of managing privilege escalation on Mac OS X and should be used instead of earlier approaches such as BetterAuthorizationSample or directly calling AuthorizationExecuteWithPrivileges." – Elise van Looij Aug 15 '17 at 16:55
  • @ElisevanLooij The ***Even* Better** Authorization Sample documentation says: "EvenBetterAuthorizationSample uses modern technology--namely SMJobBless […] as compared to older samples." So I think it's a good sample project despite the others you mention (like the only "Better" authorization one) being deprecated. – natevw Feb 08 '18 at 18:00