From 873cb3d51f1c0598133f56db9f123ab65de30485 Mon Sep 17 00:00:00 2001 From: "Oliver Surke (Gitea)" Date: Mon, 11 May 2026 21:06:29 +0200 Subject: [PATCH] fix: replace removed brctl download with open -g; add -f to mackup restore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit brctl download was removed in macOS Sonoma — the remaining subcommands are diagnose/log/dump/status/accounts/quota/monitor. Replace the dead call with a find loop that uses 'open -g ' to request per-file iCloud download from the daemon, followed by a 1-second settle pause and the existing .icloud stub deletion. Also add -f to mackup restore for consistency with the backup call. Co-authored-by: Cursor --- lib/mackup.sh | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/lib/mackup.sh b/lib/mackup.sh index 70a15b4..68dd667 100644 --- a/lib/mackup.sh +++ b/lib/mackup.sh @@ -44,13 +44,21 @@ ssr::mackup::_materialize_icloud() { *Mobile\ Documents*) ;; # only worth doing for iCloud *) return 0 ;; esac - # `brctl download` is the documented way to request file materialization. - # Available on macOS 10.12+; silently skip if missing on older systems. - if command -v brctl >/dev/null 2>&1; then - brctl download "$mackup_root" >/dev/null 2>&1 || true - fi - # Belt-and-braces: prune any stub files that survived the download - # request (sometimes left over from interrupted prior runs). + # `brctl download` was removed in macOS Sonoma (remaining brctl subcommands: + # diagnose/log/dump/status/accounts/quota/monitor). The current way to + # trigger per-file iCloud download from the CLI is `open -g `, + # which asks the iCloud daemon to fetch the file in the background. + find "$mackup_root" -name '*.icloud' -type f 2>/dev/null | while IFS= read -r stub; do + local dir base real + dir="$(dirname "$stub")" + base="$(basename "$stub")" + real="${base#.}" # strip leading dot + real="${real%.icloud}" # strip .icloud suffix + open -g "$dir/$real" 2>/dev/null || true + done + # Brief pause so the iCloud daemon can start fetching before mackup reads. + sleep 1 + # Belt-and-braces: prune any stubs that couldn't be resolved. find "$mackup_root" -name '*.icloud' -type f -delete 2>/dev/null || true } @@ -93,5 +101,6 @@ ssr::mackup::backup() { ssr::mackup::restore() { ssr::log "mackup restore" - mackup restore + # -f: answer "yes" to all prompts (consistent with backup behaviour). + mackup -f restore }