Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

10.9.1 Mail spotlight search not working!!!!! APPLE HELP!!!!!!

10.9.1 Mail spotlight search not working!!!!!

MacBook Air, OS X Mavericks (10.9.1)

Posted on Dec 16, 2013 11:32 PM

Reply
54 replies

Oct 10, 2014 1:53 PM in response to Kutten1303

This is good info, but much of it should be unnecessary.

In terminal, enter:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

Unless you see error messages in console indicating that mds is "throttling" (an error is preventing it from loading), that command is superfluous. It is already loading by default. The other reason it might be useful is if you turned it off with a similar command (unload vs load).

Then enter:

sudo mdutil -E /

Extremely useful as this command will erase the entire spotlight index forcing the OS to reindex the entire hard drive.

In your system preferences you should now be able to go to the Spotlight preferences, then the privacy tab. Click the + button and add your entire hard drive under devices. You shouldn't get an error.

Quit and reopen system preferences. Go back to the privacy tab under Spotlight preferences and this time select your hard drive from the list and hit the - button.

That is completely redundant to the above command. Unless you did something to disable indexing in the past, the erase command will force it to reindex.

The sudo mdutil -E / command is the Brute Force method of the Privacy tab gymnastics.


I would just suggest the erase command first, then try to reset everything else if erasing doesn't fix the problems. However, none of the other stuff is harmful.

Jan 30, 2015 4:38 AM in response to Kutten1303

Dear Apple Help Desk.

I tried all above methods, but still my Mac Mail search is not working. Though my Finder and top right Spotlight search works perfectly. I tried calling their US help desk. They guided me for few troubleshooting but after many attempts they said they will come with an update in new OS i.e. Yosemite. Now I purchased a new iMac with Yosemite. transferred data from my old mac and checked with mac mail. The same problem persists.

Apple support team should give some solution to this. Please

Jan 30, 2015 4:59 AM in response to jitu1978

If you want help from Apple Support, you should call them.

Given that you see the problem on two Macs using your data, something in your data or the applications you've installed is causing the problems you see.

Start a new thread here by clicking on the New link at the top of the OS X Yosemite page.

Describe all of the problems you have and what you have done to fix the issue.

Feb 4, 2015 9:08 PM in response to Barney-15E

Dear Sir,

As you suggested I reached the support team. To know the issue they took remote access of my iMac. We tried some trouble shooting when finally we could diagnose the real problem. I formatted my iMac to free os x Yosemite, then configured mail accounts and checked for the inbuilt spotlight search within mac mail. It was working absolutely fine. As soon as I copied a folder from my backup hard disk on Mac HDD, and then tried to search within mac mail, we realised it stopped working. It means this issue is related to some script/ malware associated with folder structure for backup files. I did had a virus scan for the entire backup hard disk but didn't have any virus in it.

They had taken 'mac data log' and sent it to their developer team. Now waiting for a solution from their end. Will update accordingly.

Mar 10, 2015 9:39 AM in response to DenisKlimenko

Hey all, long time lurker, first time poster. Not sure if anyone is still following this thread, but I've been dealing with a similar issue for 3 years and have scoured the internet for a solution that worked for me, to no avail. I finally think I discovered the exact cause of the issue (at least on my machine) and developed a quick fix.


Short version:


/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchSe rvices.framework/Versions/A/Support/lsregister -kill -seed -r


killall Finder


mdimport ~/Library/Mail


Long version:


My issue was that I couldn't search Mail the normal way (text-based search). If I typed "Jason" into the search box, and there was a message from Jason Brown right at the top of Inbox, it would just return no results. However, it would suggest "Jason Brown" under "People" and if I selected that, it would return all results from Jason Brown as per normal. Same thing for "Subject", etc. Token-based search was working, all other search was not working. Same thing when searching for messages from Spotlight. Mail uses two different search engines depending on if you're using token-based search or full text search. For token-based search, it relies on its own internal search. For full-text search, it relies on Spotlight. So in my case, for some reason Spotlight and Mail stopped talking to each other. The strangest thing is that for 3 out of 4 of my email addresses, search was not working, but for the 4th, it was working absolutely fine. And for those same 3 other addresses, search worked fine on my other machine. So that ruled out something with the IMAP server.


Anyhow, to cut to the chase, I tried all the normal stuff — rebuilding mailboxes, deleting Envelope Index files (that actually would only affect token-based search, but I tried anyway), deleting the entire Mail folder, re-indexing the volume, re-starting Spotlight, deleting the .Spotlight-V100 index, etc, etc. Nothing worked. I tried using 'mdimport' to specifically import my individual IMAP-<username> folder inside ~/Library/Mail/V2, and that's when I noticed something strange -- despite that folder being pretty huge (several gigabytes), mdimport was able to index it almost immediately. I found out that you can run mdimport with options '-d1' or -'d2' to debug (basically a verbose mode), yet absolutely nothing was being logged (or indexed). This is contrary to what happened when I ran mdimport -d2 on the one mail folder where search was working, or when I ran it on my other machine where search was working normally (in which case it spits out a list of all the emlx files as it indexes them).


So I was really suspicious that either (a) Mail.mdimporter was corrupted or not working, or (b) for some reason Mail.mdimporter was skipping over my IMAP-<username> folder. What tipped me off was running 'mdls' on the IMAP folder -- instead of returning a kMDItemContentType of "public.folder" the way it should, it gave a dynamically generated UTI, and kMDItemKind was "package". Looking back at the Finder, I could see (duh!) that my IMAP folders that weren't searchable were displaying as packages, whereas the ones that were searchable were regular folders.


Easy solution right? Just change the bundle bit back to off. However, I tried 3 or 4 different file utilities (including Apple's CLI setfile) and they all insisted that the bundle bit was off on those folders — which means that the Finder should be displaying them as folders, not packages. What I realized is that there's actually two different ways of telling whether something's a package or a folder. One is in the bundle bit on the directory itself — the other is somewhere in Launch Service's internal data store. Normally, the two places should always agree. Somehow on my system, they got out of sync — which caused mdworker to skip over those folders and not index them (even when they were completely removed from the filesystem and created again from scratch) because to mds, they were looking like packages and therefore their UTI was assigned to be "dyn.<SOME STRING>" instead of "public.folder", which prevented mdworker from seeing inside.


RECAP -- the paths to my IMAP folders were for some reason listed as packages instead of folders in Launch Services, which prevented Spotlight from indexing them, no matter how many times I rebuilt or deleted those IMAP folders. The solution was to restart Launch Services itself and let it rebuild its own data store, then restart Finder, then reimport the IMAP folders.


I really hope this helps somebody!!! I was tearing my hair out for years trying to fix this and it seemed to defy all logic and troubleshooting attempts.


Best,

Jesse


MacBook Pro Late 2011

Mac OS 10.8.5

Mar 12, 2015 6:39 AM in response to jessefischer

Hello jessefischer,

It seems you had found a way to resolve the mac mail search issue. I had been trying this for long long time but couldn't solve it even after assistance from Apple support (US/ UK). I am not a techie so couldn't understand the exact way to resolve the issue from your post. Its a kind request to you to put it in simple words (step wise manner) so that users like me can use it to resolve. It will be great help if the issue resolves by your methodology. Thanks in advance.

Mar 15, 2015 5:59 PM in response to jitu1978

Hi jitu1978,


Sorry for not explaining in more detail. So here's what you do.


FIRST OF ALL -- MAKE SURE ALL DATA IS BACKED UP -- use Time Machine or your preferred backup method (I like ChronoSync).


Second, before you start, I'd be curious to see if you have the exact issue I had, where the internal Mail folders were accidentally appearing as packages. Can you do some quick troubleshooting for me? In the finder, type shift-command-G (or choose "Go To Folder" from the "Go" menu) and then type "~/Library/Mail/V2" (without the quotation marks). Can you report back on what you see, and specifically if there are any files that are listed with "package" as their file kind?


Third, here are the steps that I followed. Your situation may be different, so I'm not sure how well this will work for you, but it's worth a shot.


1. Use the Spotlight menu in the top-right of your screen (or just press command-space bar) and type "Terminal".

2. Once the Terminal app opens, you will need to type these three commands exactly as they appear (it may be easier to copy and paste):


/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchSe rvices.framework/Versions/A/Support/lsregister -kill -seed -r


killall Finder


mdimport ~/Library/Mail


3. Now you should wait a bit while Spotlight re-indexes (you can tell it's re-indexing by looking in the Spotlight menu on the top-right of your screen... if it doesn't have a progress bar, then it's finished re-indexing).


Hope this helps. Please let me know if you try it and if you have any more questions.


Best,

Jesse

Mar 15, 2015 10:47 PM in response to jessefischer

Dear jessefishcher,

Thanks for your detailed reply. I am sharing with screenshots for whats seen under V2 folder & under mail spotlight search. Under V2 folder it shows my 3 mail accounts file as RARExtension, don't know whether there are same as 'packages' you mentioned in your post. Also I tried running all 3 commands (1 after other) and then tried spotlight search in mail, but it fails to give results though it suggests name as shown in my 2 screenshot. Kindly guide if I am missing something, or need to so something else to resolve the issue. Thanks in advance.User uploaded fileUser uploaded file

Jun 3, 2015 3:44 AM in response to DenisKlimenko

Dear all,

Finally I found the reason for which my Mac mail search was unable to search within my imap mail accounts. The reason was because of some malware attached with a file within a keygen folder for some app. After formatting & fresh installing OS X for 2-3 times and checking with the exact folder which affected the search engine I got to know the exact folder from backup disk which after copying affected the search engine.

To get rid of this, I fresh formatted my Macbook Air/ iMac and copied only my iTunes music & iPhotos from my backup disk. For apps I resorted to App store and individual websites. Didn't use any backup folder for apps. Hope this helps.

10.9.1 Mail spotlight search not working!!!!! APPLE HELP!!!!!!

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.