ShakaCode | ShakaCode Blog | Rails On Maui Blog | Rails | ReactJs | JavaScript | Webpack | Productivity |

Speeding up MacOS for developers by configuring Spotlight not to index node_modules


#1

Don’t index node_modules by Spotlight

It’s pretty key to turn off Spotlight for developer directories with tons of files. There’s just no reason you’ll use the Mac find to look for node_modules.

These two aliases should be useful to clean stop MacOS from indexing your node_modules folder.

alias fix-spotlight="find . -path '*node_modules/*' -prune -o -type d -name 'node_modules' -exec touch '{}/.metadata_never_index' \;"
alias fix-spotlight-globally="find ~ -type d -path './.*' -prune -o -path './Pictures*' -prune -o -path './Library*' -prune -o -path '*node_modules/*' -prune -o -type d -name 'node_modules' -exec touch '{}/.metadata_never_index' \; -print"

Reference for the script

Backup Drives

Another tip is to place any external backup drives to your Spotlight hidden folder:

image

Related to: