Difference between revisions of "Plutil"

From The iPhone Wiki
Jump to: navigation, search
(Erica's plutil: Latest (but not new) beta 17)
Line 20: Line 20:
   
 
==Erica's plutil==
 
==Erica's plutil==
  +
===Unknown version===
plutil: [command_option] [other_options] file...
 
  +
plutil: [command_option] [other_options] file...
 
-h show this message and exit
 
-h show this message and exit
 
-l output a list of the properties (default)
 
-l output a list of the properties (default)
Line 35: Line 36:
 
-1 key set the key to the boolean value true
 
-1 key set the key to the boolean value true
 
-r key remove the key/value pair for key
 
-r key remove the key/value pair for key
  +
===beta 17===
  +
<code>Help
  +
-full Print this message
  +
-help Print usage message
  +
  +
Show Files
  +
-verbose -v Show verbose output
  +
-useDebug Show useDebug output
  +
-dump Dump property list file to stdout
  +
-show Show property list data
  +
-showjson Show property list data as JSON
  +
-keys List top level dictionary keys
  +
  +
Create and Convert Files
  +
-create Create a new empty property list
  +
-convert format Convert each property list file to selected format.
  +
Formats are xml1 and binary1 and json. Note that json
  +
files are saved to filename.json
  +
-xml Equivalent to -convert xml1
  +
-binary Equivalent to -convert binary1
  +
-json Equivalent to -convert json. NOT used for typecasting
  +
-backup Create a plist backup. (File extension must be .plist)
  +
  +
Create Keypaths
  +
-key keyname Recover value for key. Multiple uses builds path
  +
-set keyname Recover value for key. (Synonym for key)
  +
-rmkey keyname Specifies a one-item keypath or adds itself as the
  +
last item of the keychain. (Toggles removal on.)
  +
-(unrecognized) Unrecognized flags are used to build keypaths
  +
  +
Setting Values
  +
-setvalue value Set value for keypath
  +
-value value Set value for keypath (Synonym for setvalue)
  +
-remove Remove value at keypath. (Toggles removal on.)
  +
-1 -yes -true Set keypath value to Boolean true
  +
-0 -no -false Set keypath value to Boolean false
  +
-int value Use integer type. (Synonym: -integer)
  +
-float value Use float type. (Synonym: -real -double)
  +
-string value Use string type
  +
-data filepath Set keypath value to the NSData read from filepath
  +
-now Set keypath value to the current NSDate
  +
-fromnow delta Set keypath value to current date off by delta seconds
  +
-beforenow delta Set keypath value to current date off by delta seconds
  +
-array Create a new array and set it as value for keypath
  +
-dict -dictionary Create a new dictionary, set it as value for keypath
  +
  +
Type Casting
  +
-type typeid Type to use while setting key. Valid types are
  +
string (default), int, integer, float, real,
  +
double, bool, boolean, data, and date. Dates use
  +
natural language conversion. Data converts value string
  +
to NSData. Use json to define arrays and dictionaries.
  +
  +
Working with Arrays
  +
-arrayadd Add value to array at keypath
  +
</code>
  +
  +
To edit nested elements (e.g. a capability bit inside the NxxAP.plist file) run
  +
plutil -key {1st level container} -key {n-level container} -key {oblect name} -{value to be set}

Revision as of 21:57, 2 May 2011

plutil is a program that can convert .plist files between a binary version and an XML version. Currently, there are two versions of this utility.

Apple's plutil

See also: plutil's man page

plutil: [command_option] [other_options] file...
The file '-' means stdin
Command options are (-lint is the default):
 -help		show this message and exit
 -lint		check the property list files for syntax errors
 -convert fmt	rewrite property list files in format
		fmt is one of: xml1 binary1

There are some additional optional arguments:
 -s		be silent on success
 -o path	specify alternate file path name for result;
		the -o option is used with -convert, and is only
		useful with one file argument (last file overwrites);
		the path '-' means stdout
 -e extension	specify alternate extension for converted files
 --		specifies that all further arguments are file names

Erica's plutil

Unknown version

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

beta 17

Help

 -full                Print this message
 -help                Print usage message

Show Files

 -verbose -v          Show verbose output
 -useDebug               Show useDebug output
 -dump                Dump property list file to stdout
 -show                Show property list data
 -showjson            Show property list data as JSON
 -keys                List top level dictionary keys

Create and Convert Files

 -create              Create a new empty property list
 -convert format      Convert each property list file to selected format.
                      Formats are xml1 and binary1 and json. Note that json
                      files are saved to filename.json
 -xml                 Equivalent to -convert xml1
 -binary              Equivalent to -convert binary1
 -json                Equivalent to -convert json. NOT used for typecasting
 -backup              Create a plist backup. (File extension must be .plist)

Create Keypaths

 -key keyname         Recover value for key. Multiple uses builds path
 -set keyname         Recover value for key. (Synonym for key)
 -rmkey keyname       Specifies a one-item keypath or adds itself as the
                      last item of the keychain. (Toggles removal on.)
 -(unrecognized)      Unrecognized flags are used to build keypaths

Setting Values

 -setvalue value      Set value for keypath
 -value value         Set value for keypath (Synonym for setvalue)
 -remove              Remove value at keypath. (Toggles removal on.)
 -1 -yes -true        Set keypath value to Boolean true
 -0 -no -false        Set keypath value to Boolean false
 -int value           Use integer type. (Synonym: -integer)
 -float value         Use float type. (Synonym: -real -double)
 -string value        Use string type
 -data filepath       Set keypath value to the NSData read from filepath
 -now                 Set keypath value to the current NSDate
 -fromnow delta       Set keypath value to current date off by delta seconds
 -beforenow delta     Set keypath value to current date off by delta seconds
 -array               Create a new array and set it as value for keypath
 -dict -dictionary    Create a new dictionary, set it as value for keypath

Type Casting

 -type typeid         Type to use while setting key. Valid types are
                      string (default), int, integer, float, real,
                      double, bool, boolean, data, and date. Dates use
                      natural language conversion. Data converts value string
                      to NSData. Use json to define arrays and dictionaries.

Working with Arrays

 -arrayadd            Add value to array at keypath

To edit nested elements (e.g. a capability bit inside the NxxAP.plist file) run

plutil -key {1st level container} -key {n-level container} -key {oblect name} -{value to be set}