Before starting:
This was tested on a MacBook Pro 2019. I cannot confirm if this method works on another machines. Also, I do not take ANY responsibility if something happens to your Mac. If you do this like im telling you to, it should work as expected.
-
Install MacOS WITHOUT ANY CONNECTION TO THE INTERNET (If the router can be turned off, please do). You can get more information on how to do this in the Apple support page: support.apple.com/en-us/102662 I performed my tests using Monterrey, since (I think) that's the OS that it came with the machine.
-
Once the main installation is finished and it starts asking you for configurations, you should note that It does skip the enrollment part, once you're in the desktop. You can re-activate the internet.
-
Reboot the machine and enter recovery mode (For me, this was done pressing cmd + R until the Apple logo shows up), open the console and perform the following steps. Don't exit recovery mode until specified.
-
Enter the command:
crsutil disable
. This will ask for a reboot. Go ahead but make sure to re-enter recovery mode. -
Once into recovery mode, open the terminal again and enter the command:
cd /var/db/ConfigurationProfiles/Settings/
-
Enter the following two commands:
rm .cloudConfigHasActivationRecord
rm .cloudConfigRecordFound
These commands can, or cannot work. They did return an error on my machine but i've tried anyway.
-
Create the following files with the commands:
touch .cloudConfigProfileInstalled
touch .cloudConfigRecordNotFound
To assure that these files were created, you can usels -a
to see all the files in the folder. If they appear after the command, you're set.
-
Run the following command:
sudo launchctl disable system/com.apple.ManagedClient.enroll
This may or may not return something in the console. (For me, it did not) -
Block the domains related to mdm enrollment. For this we're going to use Vim and open it with the command:
vim /etc/hosts
(Heres a great guide on how to use vim if needed: https://www.geeksforgeeks.org/entering-editing-mode-in-vim-editor/) Once vim is open, add the following to the end of the 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 acmdm.apple.com
0.0.0.0 albert.apple.com
- Reboot system, but re-enter recovery mode for one last command on the terminal:
crsutil enable
Once executed, it'll ask for a reboot. Go ahead and let it reboot into normal mode without pressing any keys. - Once rebooted into normal mode, login into your account. You shouldn't get the MDM pop-up anymore. Still, to be sure you can execute the following command inside a terminal. If this command returns an error, you're set.
sudo profiles show -type enrollment