- Boot into recovery using
command-R
during reboot, erase the HD using Disk Utility, and select reinstall macOS - When it reboots again, be sure to press
command-R
to boot into recovery and continue
- Open Utilities → Terminal and type
$ csrutil disable
$ reboot
-
Hold
command-R
during the reboot to enter Recovery Mode again -
Enter Disk Utility, and mount the
Macintosh HD
volume (which is mounted by default but might not be /). -
Exit Disk Utility, open Utilities → Terminal, and type
$ cd "/Volumes/Macintosh HD/System/Library"
$ mkdir LaunchDaemons.disabled LaunchAgents.disabled
$ mv LaunchDaemons/com.apple.ManagedClient* LaunchDaemons.disabled/
$ mv LaunchAgents/com.apple.ManagedClient* LaunchAgents.disabled/
- Add the following line to the /Volumes/Macintosh HD/etc/hosts file
0.0.0.0 iprofiles.apple.com"
0.0.0.0 mdmenrollment.apple.com
0.0.0.0 deviceenrollment.apple.com
0.0.0.0 gdmf.apple.com
0.0.0.0 alfred.apple.com
- In the terminal type
$ csrutil enable
$ reboot
-
If you come to the “Choose your country/location” dialogue, make sure to not select a wireless network, but “continue without an internet connection”
-
After a normal boot, you can verify the DEP status in Terminal:
$ profiles status -type enrollment
Enrolled via DEP: No
MDM enrollment: No
Note If this still doesn't work, try moving the following files in Recovery mode with csrutil disabled
$ mv "/Volumes/Macintosh HD/var/db/ConfigurationProfiles" "/Volumes/Macintosh HD/var/db/ConfigurationProfilesDisabled"