Skip to content

Instantly share code, notes, and snippets.

@paaloeye
Created August 26, 2026 19:53
Show Gist options
  • Select an option

  • Save paaloeye/53ac9aa0471c6ed5961d026ad3a9940b to your computer and use it in GitHub Desktop.

Select an option

Save paaloeye/53ac9aa0471c6ed5961d026ad3a9940b to your computer and use it in GitHub Desktop.
Time Machine Backup on Google Cloud Storage (GCS)

Time Machine Backup on Google Cloud Storage (GCS)

Backup

# Google
gcloud iam service-accounts create rclone-backup \
    --display-name "rclone GCS backup"
gcloud storage buckets add-iam-policy-binding gs://paaloeye-backup \
    --member="serviceAccount:rclone-backup@$(gcloud config get-value project).iam.gserviceaccount.com" \
    --role="roles/storage.objectAdmin"

# Rclone
./rclone config create gcs "google cloud storage" \
    project_number "$(gcloud config get-value project)"
./rclone mount gcs:paaloeye-backup ~/Backups/gcs \
    --vfs-cache-mode full \
    --vfs-cache-max-size 10G \
    --vfs-write-back 60s --gcs-bucket-policy-only \
    --log-file ~/Library/Logs/rclone_gcs.log \
    --log-level INFO \
    --stats 5m \
    --stats-log-level INFO

## Separate Terminal
tail -f ~/Library/Logs/rclone_gcs.log

hdiutil create \
    -size 1t -type SPARSEBUNDLE \
    -fs "HFS+J" \
    -volname "Time Machine" \
    ~/Backup/Paals-MacBook-Air.local-12-ab-92-de-17-a3.sparsebundle
xattr -rc ~/Backup/Paals-MacBook-Air.local-12-ab-92-de-17-a3.sparsebundle

mv ~/Backup/{,gcs}/Paals-MacBook-Air.local-12-ab-92-de-17-a3.sparsebundle
hdiutil attach ~/Backups/gcs/Paals-MacBook-Air.local-12-ab-92-de-17-a3.sparsebundle

# Time Machine
sudo tmutil setdestination /Volumes/Time\ Machine
sudo tmutil startbackup

# Get some ☕️

Restore

tmutil restore "/Volumes/Time Machine/Backups.backupdb/Paal's MacBook Air/Latest/Macintosh HD/path/to/file" ~/Desktop/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment