Skip to content

Fix: user-level MDM artifact cleanup + better volume detection - #177

Open
mateussiqueira wants to merge 1 commit into
assafdori:mainfrom
mateussiqueira:fix/user-cleanup-dirstatus
Open

Fix: user-level MDM artifact cleanup + better volume detection#177
mateussiqueira wants to merge 1 commit into
assafdori:mainfrom
mateussiqueira:fix/user-cleanup-dirstatus

Conversation

@mateussiqueira

Copy link
Copy Markdown

Problem

Two common issues with the current bypass script:

  1. MDM re-enrollment after reboot — The script only removes system-level configuration profiles (/var/db/ConfigurationProfiles/Settings/.cloudConfig*), but leaves user-level artifacts in /Users/*/Library/ (Preferences, Caches). When the user logs in, these artifacts trigger a fresh enrollment attempt.

  2. "Not a known DirStatus" error — The script assumes the data volume is named exactly "Macintosh HD - Data", but many users have non-standard volume names (custom names during install, macOS upgrades that changed naming, external SSDs with different names).

Changes

  • User-level artifact cleanup: After removing system profiles, iterate all users on the Data volume and remove MDM preferences and caches from each user's Library.
  • Auto-detect Data volume: Try 3 volume names, fall back to APFS list discovery, then mount. Fixes DirStatus error for non-standard volume names.
  • Backward compatible: All new code wrapped in existence checks. No breakage for existing setups.

Testing

Tested on macOS 26 Tahoe (Apple Silicon M4). After applying these changes, reboot no longer triggers re-enrollment. Volume detection handles 5 different naming patterns.

- Clean user-level MDM artifacts in /Users/*/Library (Preferences, Caches)
- Auto-detect Data volume with multiple fallback strategies
- Fixes 'Not a known DirStatus' on non-standard volume names
- Fixes MDM re-enrollment after reboot due to user-level cache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant