Create the following file at ~/Library/LaunchAgents/net.sourceforge.davmail.agent.plist
:
<?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>net.sourceforge.davmail.agent</string>
<key>KeepAlive</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>open</string>
<string>-W</string>
<string>-g</string>
<string>-a</string>
<string>/Applications/DavMail.app</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Run the id
command to get your uid
.
Quit DavMail, then run the following command to enable the agent:
launchctl bootstrap gui/[your uid] net.sourceforge.davmail.agent.plist
Observe that DavMail gets started automatically. You can exit and it will come back up.
Works best with the "Hide from Dock" setting enabled.