Mac – how to ignore all the node_modules folders from time machine

time-machine

How to add the node_modules folder paths to time machine ignore paths.
These folders are like tmp data for backups. These are very dense folders and also slow down TM.
Is there is a txt file which can be appended?
Maybe a command line which can append to the config.

Best Answer

I'm one of the maintainers of Asimov, a free macOS utility for automatically excluding development dependencies (npm, Composer, RubyGems, and more). It was designed for this very purpose ::looks begrudgingly at node_modules/::

The easiest way to install Asimov is via Homebrew (brew install asimov), but the GitHub repo also has manual installation instructions. Once installed, a cron job runs every day to find development dependencies and automatically exclude them from Time Machine via tmutil (mentioned above).

One more benefit is that Asimov checks for the dependency declarations (in the case of node_modules/, a package.json file) before excluding the directory from backups.

Hope it helps!