1. Boot the Mac into Recovery Mode (hold down command-r during startup)

2. Go to the Utilities menu and open Terminal and type:

cd /Volumes
ls

In the result, you should see the hard drive name of your Mac (usually, “Macintosh HD”.) Whatever the case, type

cd Macintosh\ HD

(Or whatever yours is called.) Note the backslash to escape the space in the name. Then type

cd var/db/ConfigurationProfiles

Then, type 

pwd

(pwd = Print Working Directory — verify where you are in the directory structure.) The result should say

/Volumes/Macintosh HD/var/db/ConfigurationProfiles

Again, substitute your hard drive name if it’s not “Macintosh HD.” If you are not ABSOLUTELY CERTAIN that you’re in this directory, do NOT PROCEED or you will lose data.

If you ARE in that directory, CAREFULLY type:

rm -rf *
mkdir Settings
touch Settings/.profilesAreInstalled

3. Reboot. 

You will have to manually enroll the Mac to your new MDM, i.e. it won’t automatically self-enroll, but at least you don’t have to erase it and start from scratch.

To easily remove ALL profiles from a managed mac, do the following:
1. Turn of system integrity.
Shut down the computer.
Boot up the computer while holding (command + R)
Press ‘utilities’.
Type (csrutil disable)
Restart
2. Give terminal root file access.
Open ‘Privacy and Security’ in ‘System Preferences’.
Press ‘Privacy’
Press ‘Complete Disk Access’
Unlock with the lock button at the bottom left
Add terminal.
3. Terminal Commands
Type: ‘sudo jamf -removeFramework’ into terminal, press enter.
Type: ‘sudo -i’ into terminal, press enter and enter your password, press enter.
Type: ‘cd /var/db/‘ into terminal, press enter.
Type: ‘mv ConfigurationProfiles ConfigurationProfilesOLD’ into terminal, press enter.
Type: ‘logout’ into terminal, press enter.
4. Final steps.
Restart computer.


sudo /usr/bin/profiles -D -f
To delete all profiles on the Mac without getting a prompt of “are you sure?” (forced)