Ignores node_modules directories from macOS Spotlight search
I got tired of Spotlight draining battery and CPU. It seems node_modules
were
partly to blame.
This script signals Spotlight to not index node_modules
directories.
It works by adding an empty file named .metadata_never_index
in the top-most
node_modules
directory found while searching.
Stop indexing all node_modules
directories in your current directory
(recursively):
./ignore-node_modules
Stop indexing all node_modules
directories found within another directory
(recursively):
./ignore-node_modules /path/to/folder
You can install using Homebrew or manually build from source:
Running this in your terminal adds my tap and installs the package:
brew tap blakek/blakek && brew install blakek/blakek/ignore-node_modules
- Either clone this repo or download the zip file
- Add
ignore-node_modules
to your $PATH (e.g./usr/local/bin
) - Make sure file permissions allow execution (e.g.
chmod +x ignore-node_modules
). This shouldn't be necessary when cloning, but is likely when downloading from a browser.
MIT