In my last post, I asserted that Local MCX still works in Mountain Lion. And it does. But that doesn’t mean there aren’t issues to deal with.
There have been various reports of certain MCX settings not behaving correctly — for example, it appears that currently you can’t use MCX to manage Dock settings “Once” — only “Always” management works. (And that’s not useful for us — it doesn’t allow one to set certain Dock defaults and then leave the Dock alone for the user to modify as they’d like.)
There’s another challenge if you use Local MCX in an alternate local DirectoryService node, as described here:
In Mountain Lion,
dscl refuses to write to non-default local nodes:
# sudo dscl /Local/MCX create /Computers/foo
create: Invalid Path
<dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)
This makes manipulating things in a non-default local node much harder than it was in Leopard through Lion.
You can still copy files into
/private/var/db/dslocal/nodes/MCX, and that can serve as a workaround for now. All of the packages I use to configure Local MCX do exactly that — they install plist files into
/private/var/db/dslocal/nodes/MCX/computergroups. But there is one major exception.
I have one package that does the setup for Local MCX. It makes sure the /Local/MCX node is present, makes sure it is in the search path, and makes sure that an appropriate record exists in /Local/MCX/Computers to represent the current local machine. This requires writing to the /Local/MCX node to dynamically create the computer record. We can’t just install a file, because the contents of the data in the computer record are unique for each computer.
So there’s our problem: we can’t use dscl to create a computer record in the /Local/MCX node, yet we must dynamically create an object in that node.
There are two solutions, both which rely on the fact that all objects in Local DirectoryService nodes are actually just plist files.
The first: We could use another plist creation tool to create the needed plist. We could use
PlistBuddy, for example. But that would require us to take the time to figure out how to use one of those tools to create a file that is the same as if
dscl created it.
The second: Use
dscl to create the record in the /Local/Default node. Then just move the plist from
The second approach is the one I decided to take, since it seemed easier.
Here is the script I currently use for initial Local MCX setup. If you are currently using Local MCX on Lion or earlier, I hope it is of some help if you want to continue to use Local MCX on Mountain Lion.