4

I'm running the latest OS X (10.8.1). Yesterday I discovered the Spotlight Comments feature, so I went through many of my Applications and put useful comments in that field. For example, on Music Manager.app, I put the spotlight comment "google music", since it's Google Music's manager app and I would want that to appear in my search results.

It's been at least a day now and I still don't see it when I do a spotlight search for "google music". What am I doing wrong? How long does it take for Spotlight to realize applications have comments and index them?

3 Answers 3

4

The comments should normally show up in Spotlight results after you close an information window in Finder. You can tell Spotlight to reindex directories or files with mdimport, but it should do that automatically most of the time.

The Spotlight comments seem to be stored in both .DS_Store files and extended attributes. But if a file is owned by root, Finder doesn't write the comment to an extended attribute, and it won't be seen by Spotlight either.

If you use xattr to add the comments, they are picked up by Spotlight, but they aren't shown in Finder's information windows.

sudo touch test
sudo xattr -w com.apple.metadata:kMDItemFinderComment somecomment test

If you open Finder as root, they are saved in both extended attributes and .DS_Store files.

sudo /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder
2

The simplest answer, from what I can see, is to make sure that all comments are comma-delimited. So, "google music" becomes "google, music" (without quotes). I have been using this as a "tagging" system for the past few years, and it definitely works just like this. I can't remember where exactly I discovered that commas were necessary, but I had the same problem beforehand, and no problems afterward.
The only other hitch I've hit is that occasionally I'll search for a file or folder that I know I've tagged, and it won't show up. This is because sometimes, for no good reason, these comments will just get wiped. I've never figured out how or why this happens, but it doesn't happen often, and it's never caused any serious problems. Regardless, use commas, and that should solve your problem.

6
  • 1
    And this will make Spotlight pick up the comments? Did you verify this?
    – nohillside
    Commented Sep 19, 2012 at 6:07
  • 1
    I'm more wondering about the comma. I don't see how this would change the way Spotlight includes comments and it also would be rather cumbersome for longer comments (e.g. "Pictures from Alaska trip 2009" or "Do not delete this file EVER")
    – nohillside
    Commented Sep 19, 2012 at 14:47
  • 1
    Cumbersome or not, this is the way it works. If you want Spotlight to see that you've added "Pictures from Alaska trip 2009" then it must be written as "Pictures, from, Alaska, trip, 2009". That being said, I would approach this method with more of a keyword/tagging mindset, e.g., "Alaska, trip, pictures, 2009" or similar. Trust me, this has been my tagging system for years, and if you don't use commas to delimit, it will not work.
    – soxman
    Commented Sep 19, 2012 at 15:54
  • 1
    Well, it does here. I just entered a comment without commas and Spotlight picked it up a few seconds later.
    – nohillside
    Commented Sep 19, 2012 at 16:01
  • 1
    Cool, glad it works for you that way. Maybe it's different past 10.6.8, which is what I'm running. Remember, you asked me if I verified this method, and that is the question I've answered.
    – soxman
    Commented Sep 19, 2012 at 16:07
0

If comments are not used in Spotlight searches, this symptom is most probably caused by defect file permissions.

I have followed these instructions (found here) which effectively cured the problem:

  1. Create a new folder, for example in Documents
  2. Move the problem app into this folder
  3. Select the app, then, from the menu, select File > Get Info (or right-click, then select Get Info)
  4. You will probably have to unlock the dialog by clicking on the lock symbol in the lower right and entering your credentials
  5. Click on the gear icon in the lower left, then select Apply to enclosed items... (this step performs the actual repair of the app's file permissions)
  6. Move the app back to the applications folder
  7. The keywords in the comments will immediately take effect!

Notes

There are certainly alternative ways to correct the defect file permissions, like for example using Apple's Disk Utility. However, Apple claims that starting with macOS Sierra, file permissions are automatically protected by the OS, and need not be repaired any more. This is either not true in all cases, or the defect permissions may be a legacy from upgrading to macOS Sierra from an earlier OS X version.

However, the above solution is definitely quicker than running a full disk repair.

You must log in to answer this question.

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