plistBuddy

read and write values to binary plists

plistBuddy [-xh][ -c command] file.plist

Some of the configuration files in Mac OS (found in /System/Library/LaunchDaemons , etc) are in xml format
(for example ftp.plist, (as of 10.9.5 233 XML, 21 binary), which can be edited with a text editor.

The "Apple binary property list" ones must be edited with plistBuddy a command processor ( or the GUI lingon)

-c command Execute command and exit. By default, runs in interactive mode.
-x Output will be in the form of an xml plist.
-h help

Example:

 /Library/Preferences % ls -l com.apple.apsd.plist
-rw-------  1 root  wheel  68217 Feb 22 16:38 com.apple.apsd.plist

dgec14 Preferences % sudo plistBuddy        
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

print
…
Merge file [entry] Adds the contents of plist file to entry.
Print [entry] Outputs value of entry or the entire file.
Set entry value
Add entry type [value]
Copy entrySrc entryDst Copies entrySrc to entryDst.
Delete entry
Import entry file Creates or sets entry to the file.
Revert Reloads the last saved version of the file.
Save
Clear type Clears all entries, and creates a root of type type.
Help
Exit | Quit Changes are not saved

Entries consist of property key names delimited by colons (:).
Array items are specified by a 0 integer index.

Many property key names are program specific.

Examples

:CFBundleShortVersionString :CFBundleDocumentTypes:2:CFBundleTypeExtensions

Entry types: string, array, dict, bool, real, integer, date or data

Usage Examples

Set the CFBundleIdentifier property to com.apple.plistbuddy: Set :CFBundleIdentifier com.apple.plistbuddy

Add the CFBundleGetInfoString property to the plist: Add :CFBundleGetInfoString string "App version 1.0.1"

Add a new item of type dict to the CFBundleDocumentTypes array: Add :CFBundleDocumentTypes: dict

Add the new item to the beginning of the array: Add :CFBundleDocumentTypes:0 dict

Delete the FIRST item in the array: Delete :CFBundleDocumentTypes:0 dict

Delete the ENTIRE CFBundleDocumentTypes array: Delete :CFBundleDocumentTypes

Plistbuddy Example

> plistbuddy com.apple.TimeMachine.plist
Command: print
Dict {
    LastDestinationID = 577AB420-2EA6-4BED-8E03-4E1203DFD882
    MobileBackups = false
    HostUUIDs = Array {
        9205DB27-ADBE-5C67-B58F-AE743BF777D9
    }
    LocalizedDiskImageVolumeName = Time Machine Backups
    BackupAlias = & DGerman1aȬlH+   DGerman1aȬl????     DGerman1Ȭ?Ȭ?_DGerman1a:DGerman1a    DGerman1a   DGerman1a/Volumes/DGerman1a??
    PreferencesVersion = 4
    RootVolumeUUID = 8CBD0C14-6A08-3663-A911-CE7D1DB594B0
    Destinations = Array {
        Dict {
            RESULT = 0
            BytesUsed = 267603189760
            DestinationID = 577AB420-2EA6-4BED-8E03-4E1203DFD882
            SnapshotDates = Array {
                Mon Mar 03 23:39:29 EST 2014
                Thu Mar 20 20:26:39 EST 2014
                Sat Apr 12 21:16:21 EST 2014
                Sat Apr 26 16:33:53 EST 2014
                Fri Jun 06 16:33:13 EST 2014
                Sat Jul 05 08:26:09 EST 2014
                Sun Sep 14 09:53:19 EST 2014
            }
            BackupAlias = & DGerman1aȬlH+   DGerman1aȬl????     DGerman1Ȭ?Ȭ?_DGerman1a:DGerman1a    DGerman1a   DGerman1a/Volumes/DGerman1a??
            BytesAvailable = 212371472384
            DestinationUUIDs = Array {
                B2BA3CA8-984F-39F5-8A16-261BCBC2CE28
            }
        }
    }
    ExcludeByPath = Array {
        //Users/Shared/adi
        /Users/Shared/adi
        /Library/Application Support/Microsoft/PlayReady
    }
    AutoBackup = false
}

com.apple.Syslog.plist Command: print … ProgramArguments = Array { /usr/sbin/syslogd } … Command: delete ProgramArguments Command: add ProgramArguments array Command: add ProgramArguments:0 string "/usr/sbin/syslogd -d" ## Add debug flag Command: print … ProgramArguments = Array { /usr/sbin/syslogd -d } …


> plistbuddy com.apple.iokit.AmbientLightSensor.plistrray { /usr/sbin/syslogd -d } Command: print Dict { Lux 1 = 0.000000 Keyboard Muted = false LuxSensor 1 = 84.000000 LuxSensor 2 = 215.000000 Keyboard Dim Time = -1 Keyboard Manual Brightness = 1.000000 Keyboard User Offset = 0.261857 Lux 2 = 215.000000 Backlight 1 = 0.428367 Lux Threshold = 128.153519 Backlight 2 = 1.147028 Automatic Keyboard Enabled = true }
/Library/Preferences/com.apple.apsd.plist
/System/Library/LaunchDaemons/com.apple.apsd.plist
/System/Library/Preferences/Logging/Subsystems/com.apple.apsd.plist
/System/Library/PrivateFrameworks/ApplePushService.framework/Versions/A/Resources/com.apple.apsd.plist
/System/Volumes/Update/mnt1/System/Library/LaunchDaemons/com.apple.apsd.plist
/System/Volumes/Update/mnt1/System/Library/PrivateFrameworks/ApplePushService.framework/Versions/A/Resources/com.apple.apsd.plist
com.apple.apsd.plist

Errors

Encountered unknown tag galileoConfig on line 2
Error Reading File: galileo_config.xml
Perhaps a text xml file, try editing it. Invalid Arguments plistB not plistbuddy !