Using Munki to manage Mac preferences with .mobileconfig profiles


You may sometimes script preferences using defaults write commands (don’t edit the .plist files with a text editor directly). For example, you might change Munki client preferences using a command like:

sudo defaults write /Library/Preferences/ManagedInstalls SoftwareRepoURL “https://subdomain.yourserver.com/munki_repo”
That’s fine to do, but if you’re actually managing Munki client preferences (not just for Munki-related settings but for other third-party or macOS settings), why not use Munki’s built-in support for .mobileconfig profiles?

There are several methods to get or generate .mobileconfig profiles. I’m listing them below in order of preference from top recs to not-to-top recs.

Just finding existing profiles

Chances are if you want to manage a setting, someone else has also wanted at some point to manage that setting. site:github.com mobileconfig is a great Google search for finding those.

Using mcxToProfile to generate a profile

You can create .mobileconfig profiles from existing .plist preference files you already have on a sample client machine. Just download Tim Sutton’s mcxToProfile.

Then you can run something like

./mcxToProfile –plist /Library/Preferences/ManagedInstalls.plist –identifier MunkiPrefs
and then you can hand-edit the resulting .mobileconfig file to get out anything extraneous (for example, if all you want to set is the SoftwareRepoURL).

Generating Profiles with Apple Configurator

Apple Configurator is another option.

Just click File and select New Profile.

Once you’ve selected everything you want to configure, click Save.

The code it produces is (like mcxToProfile’s) clean and easy to edit. And, yes, you usually want to edit down .mobileconfig profiles to be only the things you actually want to manage. Omit (i.e., delete) anything that you want your users to be able to manage themselves.

Generating profiles with Profile Manager

If you’re using Server.app, there’s a built-in way to generate profiles.


I usually create a test device group with no actual devices in it.

Then, under Settings, select Edit.

Find the type of setting you want to edit (there are some generic settings and then others specific to iOS or macOS). and click Configure and check off all the stuff you want configured.

Then once you’ve closed out of the editing settings space, click Save for the whole device group. This will allow you to download the settings.

Click the Download button and select macOS.

Now we’re getting to why I seldom use Profile Manager. It adds in a bunch of binary gobbledygook and shoves all of the tags together so it’s not easy to read. So, yeah, you can use it… but not fun.

Update: Apparently, you can tidy up the XML fairly easily if you want. Thanks to Ian Vonesh for the tip.

Whichever method you use, though, you can just import the .mobileconfig directly into Munki and push it out to your clients (be sure to test for unexpected behavior first before moving to production).


3 responses to “Using Munki to manage Mac preferences with .mobileconfig profiles”

  1. The following will also clean up a mobileconfig file (also works on plist files):

    plutil -convert xml1 filename.mobileconfig

    plutil can also be used to lint plist/mobileconfig/xml/json.

  2. i downloaded the mcxtoprofile.zip to desktop and extracted it. What do i do next ? Thanks for your help !!

    • It’s in the instructions above. cd (change directories) to the extracted zip folder, and then run something like:
      ./mcxToProfile –plist /Library/Preferences/ManagedInstalls.plist –identifier MunkiPrefs

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.