defaults write vs PlistBuddy vs Something Else??
defaults write vs PlistBuddy vs Something Else??
- Subject: defaults write vs PlistBuddy vs Something Else??
- From: Paul Cook <email@hidden>
- Date: Mon, 13 Dec 2010 19:21:18 -0600
I'm confused by what seem, to me at least, to be very mixed messages coming from Apple concerning which tools we should use to create and edit plists. And I'm wondering if anyone in this list might have greater clarity than I seem to have.
defaults write
Figuring out how to do complicated plists with a defaults write command can be a bit of a challenge. However, it does seem to work and is is installed in all recent versions of OS-X. The concern is that the man page for has the following nice little warning in it:
WARNING: The defaults command will be changed in an upcoming
major release to only operate on preferences domains. General
plist manipulation utilities will be folded into a different
command-line program.
It is nice of Apple to give us a warning, but it would be nicer, if they would tell us both when to expect such functionality to cease (Lion, Furball, Calico, Tabby, etc.) and to which program we should switch. (Does the replacement even exist yet??)
PlistBuddy
PlistBuddy is one of the candidates for replacement. If one opens a terminal window and types "PlistBuddy -h", the result is "-bash: PlistBuddy: command not found". PlistBuddy isn't even in the default command path. And while one could do damage to their system with PlistBuddy, they could with defaults write and even lots of other commands such as "rm", so that doesn't appear to be the reason. A "man PlistBuddy" does at least return some information, but not where it is.
My Snow Leopard machine does have a copy at /usr/libexec/PlistBuddy. But Googling the Internet for PlistBuddy, one finds suggestions for it in other locations and at least one suggestion that you ought to do a "locate PlistBuddy" to find it. (Assuming that you can count on that database having been built.) But it appears that there is uncertainty as to when and where you could first count on having PlistBuddy on a machine. And I've seen more than one suggestion that you should provide your own copy. That would seem to imply distributing Apple code, which I'm not sure we should be doing.
If PlistBuddy is to be the heir, Apple certainly didn't make it apparent.
Question
So what should one use in scripts?
Best Wishes,
Paul _______________________________________________
Do not post admin requests to the list. They will be ignored.
Installer-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden