Responsive, always-available messaging for hackers
Python Shell
Switch branches/tags
Nothing to show
Latest commit 3240f80 Nov 19, 2016 @dabrahams dabrahams brew-install fixups
Permalink
Failed to load latest commit information.
Mac/LaunchAgents Fix timing of mbsync Aug 8, 2016
conf Use dovecot's new autoindex feature Aug 6, 2016
scripts brew-install fixups Nov 19, 2016
README.md Update instructions Jul 24, 2013
notes.md Update notes Nov 5, 2016

README.md

Responsive, always-available messaging for hackers

This repository contains instructions and configuration for setting up a kick-ass local Dovecot IMAP server, that synchronizes with your remote IMAP server, and a local leafnode server for your NNTP newsgroups.

These instructions use GMail as a remote IMAP server and assume you're on a Mac, but they can easily be adapted to other platforms and configurations. They'll be especially useful if you're a Gnus user.

Strategy

  • Build and install Dovecot with powerful search/indexing capability enabled
  • Use Dovecot's super-efficient mdbox mail storage format
  • Use mbsync to efficiently keep your local and remote mailboxes in sync.
  • Run a daemon that uses IMAP IDLE to be notified of changes to the remote mailbox requiring a sync.

Packages

The official build recipies and packages for MacPorts and Homebrew are not enough to create the system described here. Details below.

MacPorts

If you're using MacPorts, you'll want to set up a local portfile repository. The instructions suggest that you put the repository below your home directory, but that will lead either to great frustration with permissions, or to you unnecessarily relaxing permissions, potentially compromising security.

Adding the following line before the default repository in /opt/local/etc/macports/sources.conf will tell MacPorts to look first in a local repository at /Library/Portfiles/localhost:

file:///Library/Portfiles/localhost

I set mine up this way:

sudo mkdir -p /Library/Portfiles/localhost
sudo chown -R "${USER}:everyone" /Library/Portfiles

For my convenience, I also added a symlink as follows (totally optional):

ln -s /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports \
   /Library/Portfiles/rsync.macports.org

Then you'll want to copy mail/dovecot2 from my personal Portfile repository into your local one (on my system, it went in /Library/Portfiles/localhost/mail/dovecot2), and then, in your local repository (on my system, /Library/Portfiles/localhost)

portindex

And finally (anywhere),

sudo port install dovecot2 +lucene +libstemmer
sudo port install isync

For the rest of these instructions, you should read $PREFIX as /opt/local.

Note: the MacPorts ticket for the updated dovecot Portfile is here.

Homebrew

I am not currently using Homebrew for this, but I did create the necessary Formulae at one point. These are probably quite outdated at the moment:

Certificates

https://wiki.archlinux.org/index.php/Isync describes how to set up some certs for your .mbsync file

IMAP Idle

Idle is the feature that notifies us when something changes on the IMAP server. We use it to get timely updates when there are changes.

  • You'll need imaplib2. I did sudo easy_install pip and then pip install imaplib2. If you have Growl installed, also pip install gntp and you'll get notifications when new mail arrives. If you're fetishistic about purity, install these in a virtualenv environment.

  • In the scripts/ subdirectory of this repository you'll find mbsync-idle-trigger, which monitors Gmail's “[Gmail]/All Mail” folder for changes and initiates a sync whenever something changes there. It also syncs when it starts up, and every 5 minutes thereafter, just in case.

  • The script contains several constants at the beginning that you may want to tweak, and one (my GMail username) that you'll definitely want to tweak.