Ventura docs for M2 Macs in this comment: https://gist.github.com/henrik242/65d26a7deca30bdb9828e183809690bd?permalink_comment_id=4555340#gistcomment-4555340
Old Monterey docs in this old revision: https://gist.github.com/henrik242/65d26a7deca30bdb9828e183809690bd/32c410e3a1de73539c76fa13ea5486569c4e0c5d
Solution for Sonoma: https://gist.github.com/sghiassy/a3927405cf4ffe81242f4ecb01c382ac
So on both my wife's laptop (2019 13" MBP) and her iMac (2020 5K iMac) I went into the Host files and blocked it there. Once you get the computer up and running (off internet) or block in router. do this.
Open Terminal
sudo nano /etc/hosts
write in the following lines
0.0.0.0 mdmenrollment.apple.com
0.0.0.0 iprofiles.apple.com
0.0.0.0 deviceenrollment.apple.com
save it and reboot
I went from Ventura to Sonoma on both NO problems at all. no popups and worked via OTA.
Just an FYI the gdmf.apple.com is the OTA updates installer. if you add that into the list, it will NOT pull updates via system preferences and you have to manually install the OS for every update its SUPEr annoying. So far any update has not overwritten these in the Hosts and it checks out that its not MDM any time.
you can check via these 2 commands
sudo profiles status -type enrollment
---this will tell you if it had DEP or MDM should say "NO" to both
sudo profiles show -type enrollment
--this will try to ping the servers for MDM enrollment, if you did it correctly you should get "Error fetching Device Enrollment config...blah blah" this is meaning that when it fetches 0.0.0.0 doesn't exist...obviously!
But anyway using this method I upgraded with NO problems at all! and did it OTA as well.