How to remove a profile on a mac from profile manager with the terminal

When managing many macs on a network it is important that you streamline and consolidate your network of computers to make it as easy as possible push out policies not only for easy management, but also security. One of the ways you can do this is using Profile Manager. It works much like Active Directory with windows based systems.

Sometimes you find yourself stuck with a mac that has some profiles associated with it and you are unable to remove the profile from the mac for whatever reason. Well don’t worry because there is a way to remove them from the command line in terminal.

First thing you want to do is see all the profiles that are associated with the mac. You can do this by running

profiles -P

This command will show you if you have any profiles on your mac and will show you which ones.

Don’t worry if you show no profiles listed, there is still a way to ensure they are all removed and any remaining code is gone.

Next there are 2 different commands you can run to removed all profiles.

profiles -d

and

profiles -D

profiles -d will delete and existing provisioning profiles and profiles -D will delete any configuration profiles. It is important you run both command to ensure you remove everything.

Once you have run both command run profiles -P again to ensure all profiles are removed.

At this point you should see all the settings invoked from your profiles removed as well as in the system preferences.

But

Sometimes this is not enough so there is a trick. Run this command.

rm /var/db .AppleSetupDone

This command will trick your mac into thinking that it needs to run the startup setup when you first got your mac. This is a helpful way to clean up things. When it asks you to create an account just create a dummy account that you can remove later. Once your done your mac should be clean and have all traces of your profiles removed.

Remember if you need to do this with many macs at the same time you can use Apple Remote Desktop which can push out many things to your macs like Installs, Files and Terminal Commands.