1

I am running Yosemite on My MacBook Air.

Spotlight settings are as below:

spotlight settings on yosemite

Even though I have not selected any option, it still shows ".h" files in result. Check below image for reference.

enter image description here

As seen in above image, there is iTunesLibrary.h file in search results.

How to stop Spotlight from indexing those ".h" files? and how to remove those ".h" files from search results?

1

Did you have Xcode installed at some point? Generally those files (which are related to software development) are only indexed if Xcode is installed and the corresponding "Developer" item in Spotlight preferences is enabled.

In any event, since Developer does not appear in your Spotlight preferences, you can try doing it the manual way, based on steps found here:

  1. Open Terminal (Applications/Utilities folder)
  2. Enter the following command and press Return. You will be prompted for an administrator password. Enter the password and press Return.

    sudo plutil -convert xml1 ~/Library/Preferences/com.apple.Spotlight.plist -o ~/Desktop/com.apple.Spotlight.plist
    
  3. Open TextEdit.

  4. Press Command-, to open the Preferences window.
  5. At the top, under "Format", select "Plain text".
  6. Drag com.apple.Spotlight.plist from your desktop onto the TextEdit icon on your Dock.
  7. Press Command-F to search and type in SOURCE (in all uppercase like that). Press Return to search.
  8. If it finds something that looks like this:

            <dict>
                <key>enabled</key>
                <true/>
                <key>name</key>
                <string>SOURCE</string>
            </dict>
    

    Then change <true/> to <false/>. Save and close the document, quit TextEdit and skip to step 12.

  9. If it did not find anything like that, copy that whole block (from <dict> to </dict>).
  10. Search the document again for <key>orderedItems</key>. On the next line after that, it should say <array>. Scroll down until you find </array>.
  11. Click to place your cursor at the beginning of that line and paste. If it now looks like </dict> </array>, click to place your cursor right after </dict> and press Return to put </array> on its own line. Save and close the document and quit TextEdit.
  12. Back in Terminal, enter the following command and press Return. You may be prompted for an administrator password. If so, enter the password and press Return.

    sudo plutil -convert binary1 ~/Desktop/com.apple.Spotlight.plist -o ~/Library/Preferences/com.apple.Spotlight.plist
    
  13. Press and hold Option-Command and right-click on the Finder icon on your Dock. Select Relaunch from the menu.

  • I didn't install developer tools at all :( – I-M-JM May 13 '15 at 4:52
  • Well, somehow the setting to index them got turned on. – tubedogg May 13 '15 at 4:53
  • Steps you mentioned didn't work so I am trying something else. – I-M-JM May 13 '15 at 7:58
  • I excluded from scanning following folder: /Library/Frameworks/iTunesLibrary.framework/ and somehow it worked. – I-M-JM May 13 '15 at 8:01

You must log in to answer this question.

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