Thunder
Thunder

Reputation: 631

Launch Agent running per logged in user

I'm trying to configure a launchd agent which should run on demand when my app wants to communicate with it.

Tried few approaches like using WatchPaths or a socket port but the problem arises when there are few users logged in to the system (via fast user switching).

If I monitor a path or port and User A opens my app, the agent sometimes starts through the User's B session and vice-versa, because they both monitor them.

When I'm logged in as User A, I want the Launch Agent run as this user.

My plist is stored in /Library/LaunchAgents. Any ideas?

Upvotes: 0

Views: 373

Answers (1)

Parag Bafna
Parag Bafna

Reputation: 22930

Place your launch agent in ~/Library/LaunchAgents and create WatchPaths in user space(~/Library/Application\ Support/yourApp/watch)

Upvotes: 0

Related Questions