Prior to Lion Mail keeps its database at ~/Library/Mail/Envelope Index
. For Lion it's ~/Library/Mail/V2/MailData/Envelope Index
.
It's a sqlite database. To regenerate the entire file simply quit mail then delete the file. Mail will create a new one at next launch (it may take a while depending on the size of your mailboxes).
Caveate: I've only done this prior to Lion. I see in my MailData
directory there are several files on Lion I'm not familiar with, so it may behave differently. You're responsible for backing up your own data before nuking anything.
Right, but this is the actual Mail database, correct? As in, all the emails and so and so forth. I wouldn't want to delete that, just the search index.
I guess I could open the sqlite database and trawl through it hoping to find a search table that I could clear, but that would be uber-risky in the extreme... – Mahmoud Al-Qudsi – 2011-08-22T14:13:47.623
No it's not all the email messages themselves. Those will all be in a directories named after your account. E.g.,
IMAP-username@imap.gmail.com
. – bahamat – 2011-08-22T17:20:43.430Worked a treat. Thanks. Sorry about the confusion, I had read a very similar solution on another site that would have had me delete the entire inbox. – Mahmoud Al-Qudsi – 2011-08-23T00:44:25.620