nbalonso.com

Relative Paths in Configuration Profiles

| Comments

Apple wants you to use configuration profiles for setting up your client preferences. And because I don’t want to fight the fruity company I decided that this year I was moving (most) of my first boot scripts and custom plists to config profiles.

One issue I faced and that could not get my head around is that, if you want to set up the users’ Dock with no merging (that is getting rid of Apple default apps) you loose the ability to add user folders. Including the always-useful Downloads folder.

I tried all the combinations with no luck and even though very seriously on going back to fighting the fruit company and keep using non-standard ways of setting the Dock.

Then I found this key

1
2
3
4
5
6
7
8
9
10
11
bash-3.2$ defaults read /System/Library/CoreServices/Dock.app/Contents/Resources/en.lproj/default.plist persistent-others
(
        {
        "tile-data" =         {
            arrangement = 2;
            "home directory relative" = "~/Downloads";
            showas = 1;
        };
        "tile-type" = "directory-tile";
    }
)

It was like “home directory relative… Whaaaat?!” (insert your favourite meme)

Correct. That thing just works, and looks like it is the official fruity way that has been around since 10.5 and I had absolutely no clue.

Here is the bottom of my Dock.mobileconfig which works perfectly fine

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<key>static-others</key>
    <array>
      <dict>
      <key>mcx_typehint</key>
      <integer>2</integer>
      <key>tile-type</key>
      <string>directory-tile</string>
      <key>tile-data</key>
      <dict>
        <key>arrangement</key>
        <integer>2</integer>
        <key>home directory relative</key>
        <string>~/Downloads</string>
        <key>showas</key>
        <integer>1</integer>
      </dict>
      <key>tile-type</key>
      <string>directory-tile</string>
      </dict>
    </array>

As one last addition to the post I want to add that if you try to edit a configuration profile you downloaded from your MDM by hand, to do things like this or any similar thing, you will see that the .mobileconfig is 4 lines and is not indented. I did open a bug for this but it was closed because it doesn’t affect functionality. Yeah! it only makes admins their tasks a bit more difficult :S

In case you want to automatically indent the file without breaking the plist just paste the content on this free XML parser from the App Store. It has been a time saver for me

Comments