From 1b9aa3474554898a52f3f8614459c5c82ed9fa37 Mon Sep 17 00:00:00 2001 From: Nikolas Grottendieck Date: Mon, 10 Apr 2023 20:53:03 +0200 Subject: [PATCH] address full disk access issues that may be encountered during macos setup See https://github.com/mathiasbynens/dotfiles/issues/849 --- macos.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/macos.sh b/macos.sh index a33417f8a5f..8c6c6562373 100755 --- a/macos.sh +++ b/macos.sh @@ -76,9 +76,13 @@ parse_params "$@" setup_colors # script logic here +bash_path=$(readlink -e "$(which bash)" 2&>/dev/null || readlink -f l "$(which bash)") if [[ -z "${force-}" ]] || [[ "${force-}" == 0 ]]; then msg "${RED}This will modify macOS system settings and applications.${NOFORMAT}" + msg "${RED}Full Disk Access is required for this, see: https://support.apple.com/en-us/HT210595${NOFORMAT}" + msg "${RED}To do so add '${bash_path}' to Full Disk Access via ' > System Settings > Privacy & Security > Full Disk Access > +' ${NOFORMAT}" + msg "${RED}Please restart your Terminal afterwards to apply the changes.${NOFORMAT}" msg "${RED}Only proceed if you read the script contents and are fine with the settings.${NOFORMAT}" read -rp "Are you sure? (y/n) " -n 1 echo "" @@ -87,6 +91,9 @@ if [[ -z "${force-}" ]] || [[ "${force-}" == 0 ]]; then fi fi +full_disk_access=$(plistbuddy -c 'print' /Library/Preferences/com.apple.TimeMachine.plist | wc -l) +[[ "${full_disk_access-:0}" -lt 10 ]] && die "Full Disk Access is not granted to bash. Please add '${bash_path}' to Full Disk Access via ' > System Settings > Privacy & Security > Full Disk Access > +' and restart your Terminal." + msg "${GREEN}Prepare configuration. Will ask for sudo password to make necessary changes.${NOFORMAT}" # Close any open System Preferences panes, to prevent them from overriding