Back up a Mac with rclone
rclone can back up your home folder to almost any cloud storage (I use Jottacloud). The trick is excluding everything that is a cache, can be regenerated, or is synced elsewhere already, which on a Mac used for development is a lot.
Command
brew install rclone
rclone config # set up a remote, e.g. "jottacloud"
curl -fsSL https://mifi.no/scripts/rclone-mac-excludes.txt -o rclone-mac-excludes.txt
rclone sync -v \
--track-renames \
--links \
--no-update-modtime \
--local-no-check-updated \
--exclude-from rclone-mac-excludes.txt \
~ jottacloud:backup-my-mac
--track-renames: a moved or renamed file is renamed on the remote instead of uploaded again (needs a remote with hashes).--links: symlinks are stored as small.rclonelinkfiles instead of being followed.--no-update-modtime: don't touch the remote file when only the modification time differs.--local-no-check-updated: don't fail on files that change while they upload (logs, databases). The uploaded copy of such a file may be inconsistent, so quit apps with open databases first if they matter.
Run it with --dry-run first to see what would be uploaded and deleted.
Exclude list
rclone-mac-excludes.txt
# rclone exclude list for backing up a Mac's home folder: caches, logs and files that can be
# regenerated or are synced elsewhere anyway. Use with: rclone sync --exclude-from rclone-mac-excludes.txt ~ remote:backup
# Original: https://mifi.no/scripts/rclone-mac-excludes.txt
# See https://mifi.no/docs/macos/backup-mac-rclone/
# Paths starting with / are relative to the home folder; others match anywhere.
# Caches and logs
/Library/Caches/**
/Library/Logs/**
/Library/Containers/*/Data/Library/Caches/**
/Library/Application Support/*/{Cache,Code Cache}/**
/Library/Application Support/*/Service Worker/{Cache Storage,ScriptCache}/**
/Library/Saved Application State/**
/Library/Metadata/CoreSpotlight/**
/Library/PubSub/Database/**
/Library/PubSub/Downloads/**
/Library/PubSub/Feeds/**
/Library/Containers/com.apple.geod/Data/tmp/**
/Library/Containers/com.apple.mediaanalysisd/**
# Synced elsewhere (cloud storage, mail, chat)
/Library/CloudStorage/**
/Library/Group Containers/EQHXZ8M8AV.group.com.google.drivefs/**
/Library/Application Support/Google/DriveFS/**
/Library/Mail/**
/Library/Group Containers/group.net.whatsapp.WhatsApp.shared/**
/Library/Containers/com.tinyspeck.slackmacgap/**
# iCloud Drive: with "Optimize Mac Storage", reading files that are only in iCloud downloads them
# /Library/Mobile Documents/**
/Library/Application Support/Slack/**
/Library/Application Support/Skype/**
# Browsers and editors
/Library/Application Support/Google/{Chrome,Chrome Canary}/Default/Service Worker/**
/Library/Application Support/Google/{Chrome,Chrome Canary}/Default/Application Cache/**
/Library/Application Support/Google/{Chrome,Chrome Canary}/Default/Extensions/**
/Library/Application Support/Google/{Chrome,Chrome Canary}/GrShaderCache/**
/Library/Application Support/Google/Chrome/Default/Local Storage/**
/Library/Application Support/Google/Chrome/Default/IndexedDB/**
/Library/Application Support/Google/Chrome/Default/Sessions/**
/Library/Application Support/Google/Chrome/Default/Session Storage/**
/Library/Application Support/Google/Chrome/Default/WebStorage/**
/Library/Application Support/Google/Chrome/Default/History-journal
/Library/Application Support/Google/Chrome/Default/Favicons-journal
/Library/Application Support/Code/CachedData/**
/Library/Application Support/Code/User/History/**
/Library/Application Support/Code/logs/**
/Library/Application Support/Spotify/PersistentCache/**
/.vscode/extensions/**
# These also hold settings (Claude Code's settings, skills and MCP config). Remove the lines to back them up.
/Library/Application Support/Claude/**
/.claude/**
# Virtual machines, containers, games and SDKs (large, and can be reinstalled)
/Library/Containers/com.docker.docker/**
/Library/Containers/com.utmapp.UTM/Data/Documents/*.utm/**
/VirtualBox VMs/**
/.vagrant.d/**
/Library/Application Support/Steam/**
/Library/Application Support/minecraft/assets/**
/Library/Developer/CoreSimulator/**
/Library/Developer/Xcode/**
/Library/Android/**
/.android/**
/Library/pnpm/**
# Package manager and tool caches in the home folder
/.npm/_cacache/**
/.node-gyp/**
/.yarn/**
# ~/.gradle can also hold gradle.properties with signing passwords: back that up separately
/.gradle/**
/.pkg-cache/**
/.rncache/**
/.gem/**
/.electron/**
/.composer/**
/.cocoapods/**
/.bundle/**
/.rbenv/**
/.rubies/**
/.cargo/registry/**
/.bun/install/cache/**
# Big folders that are usually re-downloadable
/Downloads/**
/Music/**
# Anywhere: dependencies, build output and OS metadata
node_modules/**
.yarn/cache/**
.cache/**
ios/build/**
ios/Pods/**
android/build/**
android/app/build/**
.git/**
.DS_Store
.Trash/**
.TemporaryItems/**
To exclude your own folders too (projects you don't need backed up, big media), put them in a second file and add another --exclude-from my-excludes.txt.
Things to know
syncmirrors deletions. A file you delete locally is deleted from the backup on the next run. With Jottacloud, rclone moves it to the Trash, where it's kept for 30 days (unless you pass--jottacloud-hard-delete), and Jottacloud keeps the last 5 versions of changed files. So an accidental delete can only be recovered for 30 days after the next backup run. Check what your provider does, or userclone copy(never deletes) or--backup-dir(moves deleted and changed files to another folder) instead.- iCloud Drive (
~/Library/Mobile Documents) is not excluded. With "Optimize Mac Storage" on, some files there are only in iCloud, and reading them makes macOS download them. Uncomment its line in the exclude list if it's backed up by iCloud well enough for you. .gitfolders are excluded, because repositories are usually on GitHub anyway. That means commits and branches you haven't pushed are not in the backup.- Run it from a terminal that has Full Disk Access (System Settings -> Privacy & Security -> Full Disk Access), or macOS blocks it from protected data like Mail, Messages and Safari, and asks before it can read Desktop, Documents and Downloads.
- External drives work the same way, for example
rclone sync -v --track-renames --exclude '.DS_Store' /Volumes/MyDrive/photos jottacloud:photos.
See also: Clearing storage space on macOS.