From d313ff5a06b6c824e8e6864fe6e40d22966b3d27 Mon Sep 17 00:00:00 2001 From: Christopher Snyder Date: Wed, 8 Jul 2026 12:23:37 -0400 Subject: [PATCH] Warn instead of abort when Safari prefs are TCC-blocked Safari's preferences live in its sandboxed container, so `defaults write -app Safari` fails unless the terminal has Full Disk Access. With set -e this aborted the entire apply; downgrade it to a warning since the TCC grant is outside the script's control. Co-Authored-By: Claude Fable 5 --- .../run_onchange_set_mac_os_defaults.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.chezmoiscripts/run_onchange_set_mac_os_defaults.sh b/.chezmoiscripts/run_onchange_set_mac_os_defaults.sh index 1e18102..7940539 100644 --- a/.chezmoiscripts/run_onchange_set_mac_os_defaults.sh +++ b/.chezmoiscripts/run_onchange_set_mac_os_defaults.sh @@ -59,11 +59,15 @@ defaults write com.apple.dock "autohide" -bool "true" killall Dock -# Safari -defaults write -app Safari "ShowFullURLInSmartSearchField" -bool "true" - -# killall fails when Safari isn't running, which is fine -killall Safari 2>/dev/null || true +# Safari — its prefs live in a sandboxed container, so writing them requires +# the terminal to have Full Disk Access (System Settings > Privacy & Security). +# Warn instead of aborting the whole apply when TCC denies the write. +if defaults write -app Safari "ShowFullURLInSmartSearchField" -bool "true" 2>/dev/null; then + # killall fails when Safari isn't running, which is fine + killall Safari 2>/dev/null || true +else + echo "WARNING: Skipped Safari defaults — grant your terminal Full Disk Access and re-run 'chezmoi apply'" +fi # Finder defaults write NSGlobalDomain "AppleShowAllExtensions" -bool "true"