Add FileVault auto-detect + unlock + user artifact cleanup - #178
Open
mateussiqueira wants to merge 1 commit into
Open
Add FileVault auto-detect + unlock + user artifact cleanup#178mateussiqueira wants to merge 1 commit into
mateussiqueira wants to merge 1 commit into
Conversation
- Auto-detect FileVault encrypted volumes before attempting writes - Prompt for recovery key or volume password to unlock data volume - Clean user-level MDM artifacts in /Users/*/Library - Expand domain blocking to 5 MDM-related Apple domains - Fix 'Not a known DirStatus' by detecting system volume via SystemVersion.plist
This was referenced Jun 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Issue #143 reports that the script fails silently on FileVault-encrypted Macs. The data volume can't be written to until unlocked, so all dscl/hosts/profile operations fail with no clear error.
Additionally:
Changes
FileVault auto-detect: Before any write operations, the script detects FileVault using two signals (keychain file + diskutil output). If enabled, prompts for the recovery key or volume password and unlocks with
diskutil apfs unlockVolume.User-level artifact cleanup: After removing system config profiles, iterates all users on the Data volume and removes MDM preferences and caches (
com.apple.mdm.plist,com.apple.mdmclient.plist,com.apple.enrollmenttool).Smarter volume detection: System volume is found by looking for
SystemVersion.plistacross all mounted volumes, not by hardcoded name. Data volume falls back to APFS listing.Expanded blocking: Added
albert.apple.comandgdmf.apple.comto the hosts blocklist.Restored missing menu options: "Disable Notification (SIP)", "Disable Notification (Recovery)", and "Check MDM Enrollment" were missing from the menu in the original script — restored.
Testing
Tested on macOS 26 Tahoe with FileVault enabled (Apple Silicon M4). Unlock flow works with both recovery key and volume password. Reboot no longer triggers re-enrollment after user artifact cleanup.