The Apple Mail application on macOS relies on a complex SQLite database, known as the Envelope Index, to organize and instantly retrieve the hundreds of thousands of emails stored on your hard drive. If this index becomes corrupted—perhaps due to a sudden power loss, a failed macOS upgrade, or a hard drive read error—the Mail app behaves erratically. You might search for an email you received yesterday and get zero results, or your inbox might appear completely empty despite your provider’s server showing thousands of messages.
Because the actual raw email files (the .emlx files) are still safely stored on your Mac, you do not need to re-download everything from the internet. You simply need to force the Mail app to completely delete the corrupted SQLite index and rebuild it from the raw files.
How to Completely Rebuild the Mac Mail Envelope Index
You must delete the hidden index files in your Library folder to trigger a database rebuild.
- First, ensure the Mail app is completely closed. (Right-click its icon in the Dock and select Quit).
- Open the Finder.
- Hold down the Option (⌥) key on your keyboard, click the Go menu in the top menu bar, and select Library. (The Library folder is hidden unless you hold the Option key).
- In the Library folder, locate and open the folder named Mail.
- Inside, look for a folder starting with the letter V followed by a number (for example, V10 or V11, depending on your macOS version). Open the highest-numbered V-folder you see.
- Inside the V-folder, open the folder named MailData.
- Scroll through the list of files and find every single file that begins with the words Envelope Index. (You will usually see three files:
Envelope Index,Envelope Index-shm, andEnvelope Index-wal). - Highlight all three of these files, right-click them, and select Move to Trash.
- Empty the Trash.
Now, open the Apple Mail app. Because the database files are missing, Mail will display a prompt stating “Mail needs to import your messages.” Click Continue. The app will rapidly scan through your raw email files and generate a brand-new, uncorrupted Envelope Index. Once the process finishes (which may take several minutes for very large inboxes), all of your missing emails will reappear, and the search function will work perfectly again.