

So I thought I’d try moving the Envelope Index out of the way entirely and see if Mail.app would rebuild the index the happy news is that it does indeed do so, so if you can’t recover your index then its not the end of the world. Unluckily, every single one of the multiple backups that I tried also appeared to be corrupt. I recently ran into Envelope Index corruption again in conjunction with what looks to be permanent, physical drive failure. After that, Mail.app launched fine without beachballing. read for each dump file I did one final PRAGMA integrity_check, which succeeded. I then proceeded to import the dumps into the new database: sqlite>. I then moved the old Envelope Index out of the way and created a new one: mv Envelope\ Index Envelope\ Index.old Now for each of the tables I produced a dump file for example, for the "alarms" table: sqlite3 Envelope\ Index '.dump alarms' > alarms.txtĪnd so on for each table in the database. Then get drop back to the command line: sqlite>. The method I used was to list all tables: sqlite>. This seemed to confirm my suspicion that corruption was the likely cause of Mail.app’s failure to launch. Which in turn reported: *** in database main *** On page 112037 at right child: invalid page number 112186 SQL error: database disk image is malformed This yields an sqlite prompt: sqlite> PRAGMA integrity_check Checking the database integrity cd ~/Library/Mail Note: These steps were performed on a Mac OS X Leopard install, but I believe they should work with little or no modification on Tiger as well (I believe Tiger’s Mail.app also uses SQLite/ Core Data as a backing store). Luckily, Apple uses SQLite (most likely via Core Data) for these databases and that means that the format and the tools are essentially open, so you have at least some means of attempting repair. There is absolutely no configuration to start, the SQLite project provides a command-line utility named sqlite3 (or sqlite3 Most of the cases, 'pip' is preinstalled Install SQLite3 on Mac OS X Python SQLite3 module To use SQLite, we need Python to be installed in our system To start, you’ll need to import the sqlite3 package: import sqlite3. I knew the kernel panic occurred at 23:13 and by inspecting the modification dates on the items in ~/Library/Mail/ I was able to see that the likely culprit was a corrupt Envelope Index database file, which had a modification date of 23:13. On rebooting after my latest kernel panic I found that I couldn’t launch Mail.app it would just beachball endlessly each time I tried to launch it.
