Mac OS X bootpd configuration

Chris Devers cdevers at pobox.com
Thu Sep 29 19:39:50 BST 2011


On Thu, Sep 29, 2011 at 1:51 PM, David Cantrell <david at cantrell.org.uk>wrote:

>
> Is there any particular reason for using this weirdo 'defaults' tool
> instead of just a text editor though?
>

More or less arbitrarily, the data in these files can be stored as XML,
binary, or old OpenStep dictionary formats. The XML & OpenStep formats are
plain text & easy enough to handle in a text editor, but that's not the case
for binary ones — and because the binary format is smaller on disk, a lot of
the system files are going in that direction since Snow Leopard at least.

The nice thing about the `defaults` command is that you don't have to worry
about this: no matter how the data is represented in the file, it knows how
to parse & update it. But if it's too fiddly to use, you can also use
`plutil` to convert to the XML format, then hand-edit, e.g.

plutil -convert xml1 /etc/bootpd.plist
sudo vim /etc/bootp.plist
plutil -convert binary1 /etc/bootpd.plist

In this case that first command might be a no-op if it started out as XML
anyway, but in other situations this can be handy.

The aforementioned PlistBuddy (inexplicably buried under /usr/libexec) can
also handle working with any plist variant, and gives you kind of an
XPath-esque way to read & write changes to arbitrarily deep & complex data
structures, so it can be useful for scripting changes to plist files that
can be otherwise difficult to work with.

-- 
Chris Devers


More information about the london.pm mailing list