title: Enable, disable and start services programmatically in macOS
body: <p>I am writing a program that comes with a service. What I did so far is to create a helper tool that can run elevated tasks for my process and can communicate via XPC.</p>
  
  <p>My program comes bundled with a service and I want to use the helper tool to install and start/stop this service so my program can have a checkbox "start service with system" in the settings.</p>
  
  <p>I can successfully copy the plist for the service, but I cannot find any way to enable, disable, start or stop the service programmatically. I think the solution to call <code>system("launchctl load /path/to/service.plist");</code> pretty ugly. Is there any mechanism in objective C to accomplish this task and get a success or failed result?</p>