Removing configuration profiles via command line

kema808
New Contributor II

Has anyone been successful with removing configuration profiles via terminal and not through System Preferences?

4 REPLIES 4

bjohnson
New Contributor

You should be able to utilize the profiles command. I'd run "man profiles" in terminal to get more specific information.

profiles -R -F /profiles/testfile2.configprofile Removes the profile file '/profiles/testfile2.mobileconfig' into the current user.

Kumarasinghe
Valued Contributor

Also you can use this;

Some useful commands
List configuration profile information for the computer (Computer Level)

/usr/bin/profiles -C

List configuration profile information for a particular user, or the current user if no Username was specified (User Level)

/usr/bin/profiles -L

List configuration profile information for everyone.

/usr/bin/profiles -P

Remove a Computer Level Configuration Profile from Command Line
1) List the computer level config profiles with their Identifier ```
/usr/bin/profiles profiles -C

2) Remove using profiles -R -p [identifier]

/usr/bin/profiles -R -p XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
```

kema808
New Contributor II

Thanks bjohnson & kumarasinghe! I tried examples in man profiles before I posted but was unsuccessful. After a few more attempts I was able to figure it out. I did a profiles -L and figured out the correct profileIdentifier (wish it provided more info as I think I kept selecting the wrong one) and finally a profiles -R -p profileIdentifier removed it.

tomt
Valued Contributor

I've been playing with this and have gotten a lot further thanks to this thread. I was able to use sudo profiles -Lv to get a complete listing of the installed profiles. It included the both profile name and the profileIdentifier along with all the settings contained in each profile.

This was done on a 10.8.5 machine.