Mbsync
From wikinotes
A tool to synchronize imap4 and a local maildir directory.
Like offlineimap but implemented in C.
Documentation
official docs https://isync.sourceforge.io/mbsync.html
Tutorials
gmail config tutorial https://people.kernel.org/mcgrof/replacing-offlineimap-with-mbsync