Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Fix Mail.app indexing issues under 10.3 Apps
This is an update to the Reduce mailbox sizes in Mail hint published last year, by deleting the index files and letting Mail.app recreate them. Now, under 10.3, everything's different...

In ~/Library/Mail, you will see various folders, like POP-user@host.domain.com, and another folder called Mailboxes, where all the rest of the mail is stored on your Mac. As you drill down into the folders, you will see that each .mbox package contains the following files:
  • .index.ready -- lets Mail.app know that the content_index file is ready for searching
  • .lock -- Lets Mail.app know who's got this mailbox open, so you don't have two copies of Mail both, say, trying to write to the same file (only exists when Mail is running)
  • Info.plist -- Contains the preferences for this individual mailbox, things like search order, etc.
  • content_index -- Is the full-text index that Mail.app uses when searching the mail
  • mbox -- This is the actual mail file, with all the messages in standard unix mbox format (more on this later).
  • table_of_contents -- Somewhat obviously, the table of contents. It also stores things like read, unread, etc.
Now, of all these files, only the mbox file is essential, the rest will all be rebuilt if they don't exist. If you have problems with the actual mbox file itself, there are utilities out there that can work with these files. If the mbox file is OK, but one (or more) of the other files are corrupt, you can delete them (quit Mail first), and Mail will happily rebuild them the next time you view that mailbox.

I was having some weird problems with Mail hanging with 100% CPU usage, and trying to retrieve messages that I'd already deleted, so I took the shotgun approach (after backing everything up) and did the following ... *WARNING - THIS WILL DELETE FILES ON YOUR COMPUTER*. Quit Mail first, then open the Terminal, and type:
% cd ~/Library/Mail
% find . -name '.index.ready' -delete
% find . -name 'content_index' -delete
% find . -name 'table_of_contents' -delete
This series of commands went through and deleted all the indexes and table of contents from all my Mail folders. Upon launching Mail again, each time I opened up a mailbox (simply by viewing it), the status area in Mail would show me that it was re-indexing all the messages. I then went through and marked everything as read, and it's all OK now.
    •    
  • Currently 3.17 / 5
  You rated: 3 / 5 (6 votes cast)
 
[20,105 views]  

Fix Mail.app indexing issues under 10.3 | 6 comments | Create New Account
Click here to return to the 'Fix Mail.app indexing issues under 10.3' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Fix Mail.app indexing issues under 10.3
Authored by: krusty76 on Aug 02, '04 08:53:11PM

there is one problem with this method. if you don't use the "Erase Deleted Messages" option under the Mailbox menu very often ... deleting the TOC will be tough on you.

i just did all those things and now i have an inbox riddled with thousands of unwanted, previously "trashed" messages that were never actually deleted. it's years of mail, so it is unlikely i will ever go back through and delete all of them.

just a small caveat. Erase Deleted Messages before removing the table_of_contents.



[ Reply to This | # ]
Fix Mail.app indexing issues under 10.3
Authored by: -ck- on Aug 02, '04 09:25:04PM

Also beware I tried this and it reset every single one of my emails in all folders as unread...



[ Reply to This | # ]
Fix Mail.app indexing issues under 10.3
Authored by: kaih on Aug 03, '04 05:42:41AM

Yes, sorry about that, I should have made it more clear what the effects of applying this hint would be.
The Table of Contents file contains all the information about that particular mail box, except the messages themselves. It holds information about read, unread, flagged etc. It also contains the IDs of messages that have already been downloaded, which earlier versions of Mail.app kept in a separate file.

For what it's worth, the POP protocol was never designed with keeping messages on the server in mind, and as such all mail clients (such as Mail.app) use various workarounds to get around this problem - it works most of the time, so people come to rely on it... POP was originally designed so the mail client could log in, check for messages, download and then delete them. Having said that, I keep my messages on the server for a week. Now, when I did this procedure, it didn't download all my read messages again - I'm not too sure what I would have done different.

---
--
k:.



[ Reply to This | # ]
Fix Mail.app indexing issues under 10.3
Authored by: rhowell on Aug 03, '04 12:59:39AM

Tell Mail.app to move deleted messages to the Trash mailbox. This will solve the problem. There's really no reason not to. By default, Mail just marks messages as deleted, but never moves them from your Inbox. Puzzling...

This feature is found in Mail->Preferences->Accounts->Special Mailboxes



[ Reply to This | # ]
Fix Mail.app indexing issues under 10.3
Authored by: mr5m on Aug 03, '04 06:30:20AM

Mail for 10.3 includes a "Rebuild" command. Any idea if this accomplished the same thing, perhaps more safely?



[ Reply to This | # ]
Fix Mail.app indexing issues under 10.3
Authored by: magill on Aug 10, '04 11:29:42PM

Note that the answer is different for POP and IMAP users:

In Mail.app -> help "rebuild mailbox" the heading:

"Messages are missing, incomplete, or garbled"

"Rebuild your mailbox. Choose Mailbox > Rebuild.

For POP accounts, the table of contents file (which you don't see) is moved aside and rebuilt, using data in the mbox file and elements of the old table of contents file.

For IMAP accounts, the table of contents file is moved aside, and locally cached messages are also discarded. All the messages are retrieved again from the server to your hard disk and the table of contents file is rebuilt from the newly downloaded messages and from data in the old table of contents file."

---
--
William H. Magill
Senior Systems Administrator



[ Reply to This | # ]