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:
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.
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.