Is there an option to limit the size of IMAP folders? Unfortunately, Mac Mail.app has no option for this and I don't want to download every email in my account.

Gmail has an option "Limit IMAP folders to contain no more than this many messages: 1000".

Thunderbird client has an option "Synchronize the most recent: XX Days/Weeks/Months/Years".