brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: tmutil addexclusion keeps node_modules out of Time Machine

Terminal
~/tips/tip-macos-tmutil-addexclusion

tmutil addexclusion ~/projects/site/node_modules

Tells Time Machine to skip a folder so it stops backing up files you can rebuild.

Some folders are huge, rebuildable and pointless to back up. Package folders are the classic case.

tmutil addexclusion tells Time Machine to skip an item.

tmutil addexclusion ~/projects/site/node_modules
tmutil isexcluded ~/projects/site/node_modules

The second command reports [Excluded] or [Included], so you can check your work. By default the exclusion is sticky: it follows the file or directory when you move it. With -p you get a fixed-path exclusion, which applies to a location instead and takes effect again when something new appears at that path.

tmutil addexclusion -p ~/projects/site/node_modules

I prefer -p for folders that get deleted and recreated by a build tool. Adding it once means it keeps working after the folder is recreated.

The caveat is simple. Excluded means not backed up, so you cannot restore it from Time Machine. Only exclude what you can rebuild.

Time Machine is a safety net, not a copy of everything on earth. A few excluded folders can make each backup run noticeably lighter.

Further reading: tmutil.8 man page, On this site: mdls -name kMDItemWhereFroms tells you where a download came from, On this site: qlmanage -p opens Quick Look from the terminal

More Terminal tips ioreg -rn AppleSmartBattery | grep CycleCount Terminal can save your windows and tabs as a window group Export a Terminal profile to a .terminal file and import it on another Mac mc hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000029}]}' All Terminal tips (116) All topics

Link