I have a bunch of shell scripts (all plain text files) in /usr/local/scripts

If I do fgrep -il '@todo' * there are 14 files which match.

If I do mdfind -onlyin /usr/local/scripts '@TODO' there are no results.

How do I get Spotlight to search these files?

n.b. Previous answers suggest adding filetypes to


but that file can no longer be edited. I'm not even sure what I would add to that file if I could edit it.

  • My hunch is that the directory is excluded outright. You can probably confirm that changing the file type to text or another one you know would and is indexed when it’s on your desktop. May be a while to unearth if inclusions are even possible now. – bmike Oct 6 '19 at 0:22
  • Huh. You might be right. I know how to exclude directories from Spotlight, but I don't know how to add one. – TJ Luoma Oct 6 '19 at 3:03
  • tbh I don't use Spotlight much, partly because of this kind of failing - as far as I'm aware it doesn't look in System Folders at all. I always use EasyFind (freeware) to look for anything 'difficult'. It's not indexed so it's slower, but it's sure to find it if it's there. – Tetsujin Oct 6 '19 at 7:13
  • You can try mdimport -i -d1 /usr/local/scripts to trigger the search. Don't know whether it works for directories Spotlight excludes by default. – nohillside Oct 6 '19 at 9:21

You must log in to answer this question.

Browse other questions tagged .