Why does offlineimap not work with launchd
TL;DR, don’t place your Maildir into Documents, Downloads or Desktop.
I’m a heavy user of offlineimap. Thanks to Homebrew, which provides a quite nice plist (which stands for “property list”) file for macOS’s launchd to start the service at login, the offlineimap always works well until macOS Vista Catalina.
Days ago, after I upgraded the system to Catalina, offlineimap stopped working, no new mails got in at all. Although I appreciate the break, it’s a thing need to be fixed.
- Run
offlineimap -o
directly, good, so it’s a launchd thing. - Enable the launchd logging, it reports “Operation not permitted” when
os.listdir()
, what? - Check the UID, it has the permission.
- Check the effective UID, it’s the same as the UID.
After almost two hours’ searching, I got nothing interesting and went back to think “Why does it not work after upgrading to Catalina?”
The answer is right in macOS Catalina Release Notes:
Launch daemons and launch agents introduce new user privacy protections. Specifying privacy-sensitive files and folders in a launchd property list might not work as expected and prevent the service from running.
🙄 Good work, Apple.