Mac OS X Server

Removing 'serveradmin settings' Entries in OS X Server

I frequently write about adding entries in OS X Servers configuration database using serveradmin. But there are a lot of causes for various symptoms in OS X and trying some post of mine might end up biting you later, if it doesn’t fix your problem and you end up leaving the keys in place in OS X Server. Therefore, let’s look at something I might tell you to do, such as set a mail relay host from serveradmin:

serveradmin settings mail:postfix:smtp_auth_relay_dict:smtp_auth_relay_host = mdm.krypted.com

Once the setting has been configured, you might want to get rid of it outright. Now, this one happens to be exposed in the GUI, so you could set it there. But that’s not really any fun. According to the man page, you should be able to delete the keys and array entries using delete as the payload. But this is one place where the man page is actually incorrect. Let’s test by using delete as the entry, as follows:

serveradmin settings mail:postfix:smtp_auth_relay_dict:smtp_auth_relay_host = delete

Run serveradmin settings for mail to list all the settings:

serveradmin settings mail

And you’ll note that the key is actually just like you typed in, where rather than expand to function as a “delete the key” command, delete becomes the actual payload as a string:

serveradmin settings mail:postfix:smtp_auth_relay_dict:smtp_auth_relay_host = "delete"

Many services have a corresponding property list that contains their settings. These are stored in /Library/Server in a Config directory nested inside the service name. So for example, settings for the mail service would be stored in /Library/Server/Mail/Config/MailServicesOther.plist. In the same folder is MailServicesOther.10.8.plist, which references the settings files for a few other services that help to make up the Mail service. Delete the array entry and you’ll have achieved your goal of removing the entry.

Some of the service configuration files are .config files instead of property lists. In those cases, look for the keys in the configuration file and restart after you change them, but make sure to check that the changes took as many times you might have something else you need to do. I frequently use fsevents to see which configuration file I’m editing when I run a command in serveradmin and then find the correct value in the plist that I’ve altered once I’ve changed something in serveradmin. Overall, the man page illustrates the most desirable way to delete custom entries. However, in the absence of this working, it’s worth noting other ways to achieve the same result.