plutil - A Nifty Tool to Edit plist Files

The plutil comes with Xcode development toolkit on Mac OS X. Erica Sadun has ported it to iPhone. This is a neat tool to process the .plist files.

The ported plutil is here: plutil for iPhone

Syntax

plutil: [command_option] [other_options] file...

 -h             show this message and exit
 -l             output a list of the properties (default)
 -k             list the top level property list keys
 -t             create new property list(s) and exit
 -c fmt         rewrite the property list in format
                fmt is one of xml1 binary1
Setting and accessing (writes to XML):
 -v key         retrieve the value for key
 -s key         set the value for key with the option given in -v
 -i key         set int value for the key with the option given in -v
 -f key         set float value for the key with the option given in -v
 -0 key         set the key to the boolean value false
 -1 key         set the key to the boolean value true
 -r key         remove the key/value pair for key


Note

-v string_value is equivalent to <string>string_value</string> in .plist file
-s key_name is equivalent to <key>key_name</key> in .plist file
-i integer_value is equivalent to <integer>integer_value</integer> in .plist file
-f float_value is equivalent to <float>float_value</float> in .plist file
-0 key_name is equivalent to <key>key_name</key><false/> in .plist file
-1 key_name is equivalent to <key>key_name</key><true/> in .plist file

Example

To add/modify a property “<key>SBFakeTime</key><string>YES</string>” in com.apple.springboard.plist, instead of editing the file directly, just enter the following command:

# plutil -v YES -s SBFakeTime ~/Library/Preferences/com.apple.springboard.plist
Setting property SBFakeTime to YES

To add/modify a property “<key>SBEnableAppReveal</key><true/>”:

# plutil -1 SBEnableAppReveal ~/Library/Preferences/com.apple.springboard.plist
Setting property SBEnableAppReveal to <true />

To list the contents of M68AP.plist:

# plutil -l /System/Library/CoreServices/SpringBoard.app/M68AP.plist
2007-12-05 21:03:48.003 plutil[1077:d03] {
    bundles = ();
    capabilities = {
        bluetooth = 1;
        camera = 1;
        editableUserData = 1;
        international = 1;
        "ringer-switch" = 1;
        telephony = 1;
        unifiedIPod = 1;
        "volume-buttons" = 1;
    };
    displayOrder = {
        buttonBar = (
            {displayIdentifier = "com.apple.mobilephone"; },
            {displayIdentifier = "com.apple.mobilemail"; },
            {displayIdentifier = "com.apple.mobilesafari"; },
            {displayIdentifier = "com.apple.mobileipod-MediaPlayer"; }
        );
        iconList = (
            {displayIdentifier = "com.apple.MobileSMS"; },
            {displayIdentifier = "com.apple.mobilecal"; },
            {displayIdentifier = "com.apple.mobileslideshow-Photos"; },
            {displayIdentifier = "com.apple.mobileslideshow-Camera"; },
            {displayIdentifier = "com.apple.youtube"; },
            {displayIdentifier = "com.apple.stocks"; },
            {displayIdentifier = "com.apple.Maps"; },
            {displayIdentifier = "com.apple.weather"; },
            {displayIdentifier = "com.apple.mobiletimer"; },
            {displayIdentifier = "com.apple.calculator"; },
            {displayIdentifier = "com.apple.mobilenotes"; },
            {displayIdentifier = "com.apple.Preferences"; },
            {displayIdentifier = "com.nullriver.iphone.Installer"; },
            {displayIdentifier = "com.apple.MobileStore"; }
        );
        special = (
            {displayIdentifier = "com.apple.springboard"; },
            {displayIdentifier = "com.apple.fieldtest"; },
            {displayIdentifier = "com.apple.DemoApp"; },
            {displayIdentifier = "com.apple.MALogger"; },
            {displayIdentifier = "com.apple.MobileAddressBook"; }
        );
    };
}

To convert a .plist file to XML format so that it can be edited on Windows, use the following command:

# plutil -c xml1 ~/Library/Preferences/.GlobalPreferences.plist
Converting .GlobalPreferences.plist to XML

After the conversion, the file can be edited using any text editors. Note: some Windows text editors may add a trailing CR (0×0D) character for each line, be sure to use a good editor (eg. UltraEdit).


One Comment

  1. Bardia Navvabian
    Posted August 3, 2008 at 3:38 am | Permalink

    thank you,your guide was very good for me :)

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*