Spotlight now treating bash scripts as ‘Document’ instead of ‘unix executable’

I have a directory of bash scripts I use frequently, and I tend to launch these via Alfred

Alfred in turn relies on Spotlight to index scripts, and assign them a meta content type of ‘public.unix-executable’

Since upgrading from Mavericks to El Capitan, Spotlight was treating SOME of these scripts as ‘public.data’ and Kind=Document
This means they can no longer be launched from Alfred

$ mdls pull_repo1

..
kMDItemContentType             = "public.data"
kMDItemContentTypeTree         = (
    "public.data",
    "public.item"
)
..
kMDItemKind                    = "Document"

Having reindexed Spotlight from scratch, it is now treating ALL of these scripts as public.data

Can anyone give me some insight as to why this has changed in recent OSX, and are there any solutions to fix it?

Answer

I found a solution, although not an ideal one

After renaming all my bash scripts to have a .sh extension, Spotlight starts indexing them as kMDItemContentType = ‘public.shell-script’

This at least means it can be picked up by Alfred

Attribution
Source : Link , Question Author : carpii , Answer Author : carpii

Leave a Comment