Skip to content

Instantly share code, notes, and snippets.

@johngrimes
Last active February 22, 2018 00:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johngrimes/99d7db109acb29546cb02f932656e3b0 to your computer and use it in GitHub Desktop.
Save johngrimes/99d7db109acb29546cb02f932656e3b0 to your computer and use it in GitHub Desktop.
Keep DavMail running with launchd

Keep DavMail running with launchd

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment