Been a user of Alfred for a long time, however whenever I search anything I get a lot of FUD results due to alfred also indexing all my web project node_modules directories.

Is there any way to path-match and exclude all results from within a /node_modules/ directory? This would greatly improve the utility of the search.

  • Look into using a script filter, which allows you to customise the results returned in the Alfred search box. But they’re also quite a ball ache to set up.
    – CJK
    Jan 25, 2018 at 9:14

3 Answers 3


Go to Preferences -> Spotlight -> Privacy (TAB) Then add the folders you want to exclude to that list.

  • 2
    A couple things seem missing. How does this match paths for dozens or hundreds of folders? Are you saying Alfred only uses spotlight?
    – bmike
    Nov 30, 2018 at 12:03
  • In Alfred 4 there is no "Spotlight" tab anymore Nov 23, 2019 at 14:47
  • 2
    @PaulRazvanBerg They mean System Preferences, not Alfred Preferences. System Preferences has a Spotlight section, and that has a Privacy tab; but it does seem to only list specific folders, rather than being able to specify a pattern (e.g. "ignore node_modules everywhere you see it").
    – gimboland
    Feb 26, 2020 at 10:41

You can also add alfred:ignore to the spotlight comments of the folder that you want exclude, in your case the node_modules folder.


This issue has been in discussion on the Alfred Forum since 2013 and unfortunately the answer is that Alfred can't really omit "node_modules" without you tagging all folders with the alfred:ignore tag. This would of course involve yet another script so it's overkill.

There is an alternative solution though: switch to yarn 2 and this issue with Alfred will implicitly go away! They built a new system-wide caching mechanism which avoids installing "node_modules" in every node project.


You must log in to answer this question.

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