macOS relies heavily on a backend indexing system called Spotlight to power its search capabilities. Every time you open the Mail app and search for a specific keyword or sender, Mail queries this index to find the relevant messages.
Over time, especially after major macOS updates or migrating data from an old Mac, this index can become corrupted. The symptoms are obvious: you search for an email you know exists, but the Mail app returns zero results, or it only returns results from several years ago.
To fix this, you must force macOS to completely delete and rebuild the index specific to the Mail application. In this guide, you will learn how to safely rebuild the Apple Mail envelope index.
Step 1: Quit the Mail App
Before you can modify the underlying database files, you must ensure the application is completely shut down.
- Open the Mail app if it is not already open.
- In the top menu bar, click on Mail and select Quit Mail (or press Command + Q).
- Ensure there is no small black dot beneath the Mail icon in your Dock.
Step 2: Access the Hidden Library Folder
The envelope index files are stored deep within your user account’s Library folder, which Apple hides by default to prevent accidental deletion of critical system files.
- Click anywhere on your desktop to make Finder the active application.
- In the top menu bar, click on the Go menu.
- Press and hold the Option (⌥) key on your keyboard.
- A new, hidden option called Library will magically appear in the dropdown list. Click on it.
Step 3: Locate the Envelope Index Files
You are now inside the hidden Library folder.
- Scroll down and double-click on the folder named Mail.
- Inside the Mail folder, you will see a folder with a “V” followed by a number (e.g., V9, V10, or V11, depending on your exact version of macOS). Open this folder.
- Inside the “V” folder, locate and open the folder named MailData.
Inside the MailData folder, look for three specific files:
Envelope IndexEnvelope Index-shmEnvelope Index-wal
Step 4: Delete the Files to Force a Rebuild
You are not going to delete your actual emails; you are only deleting the corrupted index that points to your emails.
- Select all three of the “Envelope Index” files.
- Drag them to the Trash (or right-click and select Move to Trash).
- Empty the Trash to ensure they are completely removed from the system.
Step 5: Relaunch Mail
Now, open the Apple Mail application normally.
A dialog box will appear stating “Message Import.” It will warn you that it is preparing to import thousands of messages. Do not panic—it is not downloading duplicate emails. It is simply reading all the emails currently stored on your hard drive and building a brand new, uncorrupted index from scratch.
Depending on how many emails you have, this process can take anywhere from a few minutes to an hour. Let it run uninterrupted. Once it finishes, the Mail app will open normally, and your search functionality will be completely restored and highly responsive.