One of the most annoying bugs is the continuously re-appearing and never finishing "moving e-mails" status in the bottom left corner of the app window.
But whatever you tried to do (restarting Mail, remove account and add import account again), nothing works. The reason for this is that the problem happens in the Mail database in the background – which cannot be fixed from the Mail app.
Onyx – the macOS problem solver
Luckily there's Onyx – a free application (freeware) for macOS created by French developer Joël Barrière.
OnyX is a multifunction utility that you can use to verify the structure of the system files; run miscellaneous maintenance and cleaning tasks; configure parameters in the Finder, Dock, Safari, and some Apple applications; delete caches; remove certain problematic folders and files; rebuild various databases and indexes; and more.
This is exactly what we need in this situation: Rebuild the Mail database (or index).
Donate to Onyx
As we were writing this article in February 2022, we became aware that the Onyx developer Joël Barrière is currently unemployed. However he still sticks to continuous development of Onyx. If Onyx helped you, please consider to donate.
Onyx is available for all recent macOS versions, from (current) Monterey (12.0) to Jaguar (10.2). There is a specific Onyx version for each macOS version; make sure you download the correct version!
Once the dmg file is downloaded and launched, drag the Onyx icon into the applications folder:
In newer macOS versions a warning should pop up, that Onyx requires full disk access:
To solve this, open the System Preferences and then open the Security & Privacy settings. In the left list, there should be an option "Full Disk Access". Make sure to open the lock first to edit the list of apps with full disk access. Then select Full Disk Access and add the Onyx app.
Onyx can be opened after this change in the security settings.
Now that Onyx is installed, launch the Onyx app. (Make sure you quit the Mail app now).
By default almost all tasks are selected:
However in our situation we only need to select the Mailboxes. To fix the Mail database/index, select "Delete current index".
Then click on "Execute" (bottom right button).
Onyx deletes the Apple Mail index in the background. Once finished, you can launch the Mail app again and the index will be created from scratch.
This fixes the never-ending "moving e-mails" status in the bottom left of the Mail app.