Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

spacebiscuit

macrumors member
Original poster
Sep 30, 2018
46
9
I am trying to make a launchd plist file to do some tasks prior to login, namely to start a synergy keyboard/mouse service so that I can use a shared keyboard and mouse to login to my mac.

First I'm playing around with a basic plist which should simply create a file on my desktop:

<?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.info.test.agent</string> <key>LimitLoadToSessionType</key> <string>Background</string> <key>ProgramArguments</key> <array> <string>/usr/bin/touch</string> <string>/Users/foobar/Desktop/TestAgentDidRun.txt</string> </array> <key>RunAtLoad</key> <true/> </dict> </plist>

As I understand it I should put the file in Library/LaunchDaemon since I want this to execute before login. When I run the following:

launchctl load ~/Library/LaunchAgents/com.info.test.agent.plist

...the response I get is: Service cannot load in requested session.

If I try a reboot the file is not created. I'm running Mac OS 10.15.7

Thanks in advance.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.