Highly recommend mbsync/isync for backing up your email. Quite simple to set up for fastmail, gmail. Everyone recommends n+1 backups of everything else, why should your email be less deserving?

As a bonus, if you install notmuch you get quick offline searches and can "mine" your email with shell scripts (or easily share it with sam altman if you're into that kind of thing).

(Alternatively, if you prefer being GUI, just install Thunderbird – this can also download your full imap and give you local search. You don't even have to use Thunderbird for it to be useful as a backup; it's probably the easiest way to quickly become more independent from google randomly deciding your account should be locked, which does happen.)