How do you synchronize your notmuch tags across multiple machines?

Dan Čermák dan.cermak at
Tue Jan 8 15:54:00 PST 2019

David Mazieres <dm-list-email-notmuch at> writes:

> Dan Čermák <dan.cermak at> writes:
>> Could you maybe elaborate in more detail, as I don't know how it would
>> help me exactly? Are you running a server for syncing your tags?
>> My problem is the following: I have 3 machines E, B and C of which none
>> is always up and running. I would like to be able to sync my email on
>> any of the machines with offlineimap (but always only with one syncing)
>> and to transfer what's missing to the others, once I switch the
>> currently used machine.
> The problem is that muchsync doesn't know about imap or offlineimap.
> Muchsync will happily ensure that all of your notmuch maildirs and tags
> are synchronized.  But if you run offlineimap on E and then sync E to B,
> B will already have a copy of all new messages.  If you run offlineimap
> on B then, it will download additional copies of the messages already
> synchronized over muchsync.
> One solution would be to archive all the messages downloaded with
> offlineimap as you download them.  But then you have to remember to run
> muchsync to upload them to other machines, or you risk losing track of
> messages if you download them to a machine that you then immediately
> turn off.
> I'm open to other ideas if they require some kind of new feature from
> muchsync, but I'm worried that this would require delving into the guts
> of offlineimap (and then wouldn't work with other solutions like isync).

I am afraid that you are right in terms of delving into

I have experimented a little with offlineimap + muchsync, but I couldn't
get offlineimap to recognize messages that muchsync downloaded. My guess
is that offlineimap keeps a separate UID database somewhere, that
muchsync would have to write to. Messing with offlineimap's internal
state sounds wrong to me.

> The ideal solution would be to implement an imap server on top of
> libnotmuch.  If we had that, then you could just use offlineimap and
> isync through the imap (as opposed to file system) interface, and
> everything will just work.

Stupid question: how would the tags be synced with your local machines
in this case? Via muchsync or would one keep the tags on the
notmuch-imap server?

> That would also have the benefit of making
> notmuch work really well with phones--you could use the gmail app on
> your phone and the emacs/vim front-end on your desktop.  It's even
> conceivable that such an imap server could use notmuch's indexing to
> support the gmail imap extensions:
> Unfortunately, implementing an imap server is a bit beyond the scope of
> muchsync and not something I have time for right now.
> David

How about a hacky and not ideal solution: "teach" notmuch to not only
synchronize the read and deleted tags with the maildir, but all tags?
E.g. by injecting a header into the email?
I would guess that this is simpler to implement then an IMAP server, but
it carries its own set of problems (iirc there were discussions about
such an idea on this list but were discarded for reasons that I don't
remember). For instance I don't know whether one could even push tags to
the server, as one would have push the whole message back.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <>

More information about the notmuch mailing list