enforce launchAgent running on all users.

Hi,

I'd like to load an xpcService for all active users in advance. Moreover, when new user become active, I want that a dedicated process for that user will be spawn automatically, and not wait for an xpc message.


Here's my plist under /Library/LaunchAgent/:

Code Block
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>com.company.service</string>
        <key>RunAtLoad</key>
        <true/>
        <key>EnablePressuredExit</key>
        <false/>
        <key>POSIXSpawnType</key>
        <string>Adaptive</string>
        <key>ProgramArguments</key>
        <array>         <string>/Applications/myApp.app/Contents/XPCServices/myXpcService.xpc/Contents/MacOS/myXpcService</string>
        </array>
        <key>MachServices</key>
        <dict>
                <key>com.company.service</key>
                <true/>
        </dict>
</dict>
</plist>


If I'm using launchctl load than launchd manage the processes for each user which means that the process can be invoked only once an xpc client decides it's needed to raise.

Is there any way to run those processes in advance for all current users, and each additional user which becomes active ?

To start, you should not package your launchd agent as an XPC Service. A launchd agent can vend an XPC service but it is not an XPC Service. Attempting to blur that distinction will not yield any benefits and is likely to cause you long-term grief.

Beyond that, I’m not sure what your asking for here. Can you clarify the specific problem you’re having?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
enforce launchAgent running on all users.
 
 
Q