I've been using this to sync to a local dovecot installation. It's the best solution I could find that would allow me to have a local backup in a standard format (ie. I can see the individual email messages in a Maildir) and also be able to browse/search the backup using a mail client.
It's not that clear from the website but you should find imapsync in your distribution's package repo if you want to try it before supporting the author. I don't doubt the "no questions asked" refund policy, but I'm done fighting for my money back after bad experiences in the app stores.
You can also find the 'GitHub version' (which I'd guess is where distributions get their versions from) at https://github.com/imapsync/imapsync . I used this for an uncomplicated transfer from one IMAP server to another; it felt pretty slow but with the right CLI flags it is interruptible/restartable, and I didn't end up with lost or duplicate mail.
It comes with the author's custom "no limits" licence (looks a lot like the WTFPL), so it probably qualifies as free & open source, but you don't get a support contract of course.
The author's site also has a "give me your IMAP credentials and I'll migrate your mailbox for you, free up to a size limit" service, https://imapsync.lamiral.info/X/ , which boggles the mind. On principle I couldn't trust it.
Did you do anything particular config-wise for accessing your local instance of dovecot? I tried with [0] but the connection times out when trying to connect via Thunderbird…
It's not that clear from the website but you should find imapsync in your distribution's package repo if you want to try it before supporting the author. I don't doubt the "no questions asked" refund policy, but I'm done fighting for my money back after bad experiences in the app stores.