Automate offlineimap sync using Launchd on Mac OSX

I am now on a mutt + offlineimap setup for both my work and personal emails (love thy mutt), I will put a post later on why and how am I doing it, posting how to automatically run the offlineimap on a MacOSX (10.8) using Launchd.

Create a file in user’s LaunchAgents directory, the label naming convention that Apple uses a typically weird but okay as long as it works:


My offlineimap plist file looks like this:

< ?xml version="1.0" encoding="UTF-8"?>
< !DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">

                -a AbhinavAbhinavOrg

Then run following to submit it to Launchd.

launchctl load ~/Library/LaunchAgents/org.abhinav.mail.abhinav.plist

In short, above plist file tells Launchd to start the offlineimap application with -a mailboxname argument every 60 minutes and start at load also, time it out if it’s running or stuck for more than 180 seconds and puts stdin and stderr in defined logs. Works beautifully for me.

I took help from here, here and Steve Losh’s guide to a homely mutt.

This entry was posted in mail, open and tagged , , , , , , , , , , , , . Bookmark the permalink.

2 Responses to Automate offlineimap sync using Launchd on Mac OSX

Leave a Reply

Your email address will not be published. Required fields are marked *