Exclude node_modules folder from Time Machine backup
Stefan Kolb
Posted on March 30, 2024
Note: This post was originally published on my blog.
On macOS, TimeMachine is a great tool for backing up your Mac. However, if you work on a lot of JavaScript projects, you probably have a couple of node_modules
folders that don't need to be included in your backup. Here is how you can list, add and remove folders from your Time Machine backup.
# List currently excluded node_modules folders
$> sudo mdfind "com_apple_backup_excludeItem = 'com.apple.backupd'" | grep "node_modules"
# Exclude a folder from backup
$> tmutil addexclusion ABSOLUTE_PATH_TO_FOLDER
# Remove folder from the list of excluded folders
$> tmutil removeexclusion ABSOLUTE_PATH_TO_FOLDER
Of course, this also works with any other folder, not only node_modules
.
If you don't want to use the terminal, you can also use macOS' system settings: System Settings -> General -> Time Machine -> Options
(for macOS Sonoma).
๐ ๐ช ๐
๐ฉ
Stefan Kolb
Posted on March 30, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.