0

I know how to create a launch agent with a normal application say "myLaunchd" and setting "Application is agent" to "YES" and then copying the "myLaunchd.app" to the main app's Contens/Library/LoginItems.

But I need agents, which will be created by some scripts and the main-app's bundle-identifier will be provided through command line arguments.

I tried with a console app, tried using it as launch agent, but it doesn't work expected. I noticed that a normal app keeps running until it is closed (if "Application is agent" is set to "NO"). So to achieve similar effect I forced the console app to run-infinitely using while(1), but no luck.

Any suggestion will be appreciated.

Anoop Vaidya
  • 46,283
  • 15
  • 111
  • 140
  • Are you talking about an agent _application_ (a background app), or a _launch_ agent (a `launchd` managed background process)? – red_menace Mar 22 '19 at 19:34
  • @red_menace: agent application as I say "Application is agent = YES" in plist – Anoop Vaidya Mar 22 '19 at 19:37
  • That doesn't really answer the question. A "user agent" is a process (it can be an application, but could be just a process) that is registered with `launchd` and runs when the user is logged in, independently of your app. Is that what you're trying to accomplish? – James Bucanek Mar 23 '19 at 19:24

0 Answers0