96

I have a strange issue where Matlab stubbornly refuses to appear in Spotlight search results.

I'm not sure what information to provide besides the fact it clearly exists in Applications:

terminal showing matlab is there

It even appears in Launchpad just fine:

spotlight showing matlab is there

I don't have anything blocked from being indexed by Spotlight:

spotlight settings

And yet, even searching for the exact name in Spotlight only yields some crash log.

spotlight search

The Spotlight search also works just fine for anything else / any other apps, and it updates fine (for example, I just searched it for the screenshots I made, and it found them) so it is not just "stuck".

Any ideas?

  • Are you looking for Spotlight to just show you the Matlab or do you have a folder of Matlab docs you want indexed? – fsb Apr 30 '16 at 22:54
  • @fbara: just Matlab so I can open it quickly using spotlight. – houbysoft May 2 '16 at 6:57
  • @fbara: thanks, but unfortunately, doesn't work, just tried it – houbysoft May 4 '16 at 2:07
  • @fbara: actually, today it started working... I'm not sure if I just didn't wait long enough after doing what you suggested or if it's unrelated, but if you want to post what you said as an answer I might as well accept since it's now resolved. – houbysoft May 7 '16 at 0:08
  • I'm glad it started working! I've posted the answer. – fsb May 7 '16 at 14:19
187

Go to System Preferences --> Spotlight --> Privacy. While that's open, go to Finder --> Applications and drag Matlab from Applications into Privacy. Close out System Preferences then reopen it and remove Matlab from the same place.

This will force a reindex for Spotlight. I've seen this work for some people and not for others but it's worth a shot.

  • 1
    This also worked for me with Genymotion not being found. – Obromios Sep 18 '16 at 22:51
  • 2
    It's worth noting that this is rebuilding the index, so after you do this, wait just a bit before giving up on it. – LadyCailin Sep 21 '16 at 23:09
  • 2
    Brilliant. This fixed this issue for me. Big thanks! – Ryan Farley Apr 9 '17 at 21:56
  • 4
    This is only a temporary fix. The issue reoccurs after an indeterminate amount of time. – evolutionxbox Apr 12 '17 at 14:11
  • 2
    Worked! Any clue why this is happening in the first place? – Alec Jacobson Jun 27 '17 at 19:24
80

In a terminal, enter:

sudo mdutil -E /

I tried the Preferences --> Spotlight --> Privacy suggestion with the /Applications folder but that did not work for me.

Then I tried sudo mdutil -E /Applications in a terminal, and that didn't work either.

It's possible that using the Preferences --> Spotlight --> Privacy suggestion with the entire disk would have worked also, but in any case, I find typing that single command (sudo mdutil -E /) on the command line easier.

This command starts the reindexing process and then quickly exits, so it may take a while after it has run for your application to be accessible via Spotlight. An easy way to see if it's still indexing is to start spotlight (command-space) and type at least 1 character. If it's reindexing, it will say "Indexing" just below the text entry field.

  • Works great and much easier to do – stevyhacker Mar 12 at 14:48
11

I've never tried it, but running mdimport -d1 /Applications/Matlab_R2015b.app in the Terminal might work as well. You can increase the number up to 4 for increasing debugging information, which might tell you why the indexing isn't working. You can find other command line options at mdimport's man page.

  • 3
    Why does this get voted down? I think triggering the re-indexing via adding and removing the target to Spotlight's Privacy blacklist is rather awkward, even though it's also what Apple recommends on some support page. Triggering the re-indexing via terminal seems much more efficient to me. sudo mdutil -E /Applications might also be worth a shot. – anothernode May 3 '17 at 16:45
  • 1
    The other reindexing solutions didn't work for me. Manually adding the app into Spotlight's cache seemed to be the only thing that worked. – Mr Rogers Aug 1 '17 at 20:11
  • this is the only solution that worked for me as well – Ronnie Feb 5 at 19:01
7

I had a very similar issue recently where some apps just didn't want to show up after moving all my data to a new Mac. I tried all the suggested solutions, yet nothing has helped. Inspecting the apps in more details, I noticed that they had "eXtended ATTRibutes" (xattr) which were named:

com.apple.finder.copy.source.inode#N
com.apple.finder.copy.source.volumeuuid#N

These attributes, among others, are set when files are copied within Finder. In case you ever wondered why apps getting copied are grayed out until the copy has finished and how the Finder can show copy progress within the Finder window itself (and not just within the copy dialog) - that's all done by different kind of attributes that are set on the file and telling the system that this file/folder/bundle is just being copied and how much of it already was copied.

Usually Finder removes all these attributes after copy, but somehow these attributes got stuck in my case and with these attributes set, Spotlight refuses to show the apps, thinking they are still in the process of getting copied.

I had to manually remove them to fix that problem:

xattr -d com.apple.finder.copy.source.inode#N PATH
xattr -d com.apple.finder.copy.source.volumeuuid#N PATH

With PATH being the full path to the application (just drag it from Finder into a Terminal window and the full path is written there). Depending on access permissions/ownership, you may have to prepend the commands with sudo to gain extended privileges.

I thought it may be helpful to share that information with the world, that's why I'm posting it here.

  • Great suggestion. I found that I had an app with an com.apple.quarantine xattr set. Removing that attribute allowed it to immediately show up in Spotlight searches. – Dan Waylonis Mar 25 '17 at 22:34
6

Quicker alternative to the accepted answer:

  1. Go to System Preferences --> Spotlight --> Search Results
  2. Untick Applications
  3. Tick Applications

You may need to close and re-open preferences between (2) and (3).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .