Reading up on how to improve my suddenly-very-slow Mail app, I found the tip to rebuild the sqlite index:
sqlite3 ~/Library/Mail/V4/MailData/Envelope\ Index vacuum;
But I get an immediate "Segmentation Fault: 11" and nothing happens. Can't figure out what that means or how to solve it. It's about the first time Google hasn't provided an answer for me. Anyone? (I'm on 10.12.x which is why it's V4.)
Best Answer
‘Segmentation fault: 11’ almost always means the process ran out of RAM whilst trying to perform some operation/calculation. This would corroborate with your slow Mail due to the size of the database you're trying to process (or it's just corrupted in such a way).
It may also be worth checking your free disk space, since the VACUUM command specifically requires plenty of space:
https://sqlite.org/lang_vacuum.html