Tuesday, November 6, 2012

Appending to an array in a plist

Handy commandline to append an item to an array in a plist:
/usr/libexec/PlistBuddy -c "Add :SomeArray: string 'newstring'" /Library/Preferences/com.something.plist
If you want to operate on a specific item, you can specify a 0-based array offset, this deletes the first element in the array:
/usr/libexec/PlistBuddy -c "Delete :SomeArray:0 string" /Library/Preferences/com.something.plist

1 comment:

Anonymous said...

Muchas, muchas gracias!!!