diff --git a/features/conversation-assistant/macos/install.sh b/features/conversation-assistant/macos/install.sh index c6b11ba71..b7e591b3d 100755 --- a/features/conversation-assistant/macos/install.sh +++ b/features/conversation-assistant/macos/install.sh @@ -238,21 +238,42 @@ show_permissions_guide() { echo "The Conversation Assistant requires Full Disk Access to read the iMessage database." echo "" echo "To grant access:" - echo " 1. Open System Settings → Privacy & Security → Full Disk Access" + echo " 1. System Settings will open to Full Disk Access" echo " 2. Click the '+' button" echo " 3. Navigate to: $INSTALL_DIR/$APP_NAME.app" echo " 4. Select the app and click 'Open'" echo " 5. Enable the toggle next to $APP_NAME" echo "" - read -p "Press Enter to open System Settings, or 'n' to skip: " open_settings - - if [[ "$open_settings" != "n" && "$open_settings" != "N" ]]; then - # Open System Settings to the correct pane (macOS Ventura+) - open "x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles" + # Check if running interactively (has a TTY) + if [[ -t 0 ]]; then + read -p "Press Enter to open System Settings, or 'n' to skip: " open_settings + if [[ "$open_settings" != "n" && "$open_settings" != "N" ]]; then + open_fda_settings + fi + else + # Non-interactive mode (SSH batch) - auto-open settings + print_info "Opening System Settings → Full Disk Access..." + open_fda_settings fi } +open_fda_settings() { + # Open System Settings to Full Disk Access pane (macOS Ventura+) + # Use osascript to ensure it opens in the user's GUI session (works via SSH) + osascript -e 'tell application "System Settings" + activate + delay 0.5 + tell application "System Events" + keystroke "Full Disk Access" + delay 0.3 + key code 36 + end tell + end tell' 2>/dev/null || \ + open "x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles" 2>/dev/null || \ + open "/System/Applications/System Settings.app" 2>/dev/null +} + register_device() { print_step "Starting the agent for device registration..."