Difference between revisions of "Plutil"

From The iPhone Wiki
Jump to: navigation, search
m (Updated "Apple's plutil" to Lion's and made the page title lowercase.)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
  +
{{lowercase}}
 
plutil is a program that can convert [[wikipedia:Property list|.plist]] files between a binary version and an XML version. Currently, there are two versions of this utility.
 
plutil is a program that can convert [[wikipedia:Property list|.plist]] files between a binary version and an XML version. Currently, there are two versions of this utility.
  +
 
==Apple's plutil==
 
==Apple's plutil==
 
'''''See also:'' [http://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/plutil.1.html plutil's man page]'''
 
'''''See also:'' [http://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/plutil.1.html plutil's man page]'''
Line 8: Line 10:
 
-lint check the property list files for syntax errors
 
-lint check the property list files for syntax errors
 
-convert fmt rewrite property list files in format
 
-convert fmt rewrite property list files in format
fmt is one of: xml1 binary1
+
fmt is one of: xml1 binary1 json
  +
-p print property list in a human-readable fashion without attempting to convert the actual data
 
  +
(not for machine parsing! this 'format' is not stable)
 
There are some additional optional arguments:
 
There are some additional optional arguments:
 
-s be silent on success
 
-s be silent on success
Line 17: Line 20:
 
the path '-' means stdout
 
the path '-' means stdout
 
-e extension specify alternate extension for converted files
 
-e extension specify alternate extension for converted files
  +
-r if writing JSON, output in human-readable form
 
-- specifies that all further arguments are file names
 
-- specifies that all further arguments are file names
   
 
==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 40:
 
-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}

Latest revision as of 05:40, 19 March 2013

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 json
 -p             print property list in a human-readable fashion without attempting to convert the actual data
                (not for machine parsing! this 'format' is not stable) 
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
 -r		if writing JSON, output in human-readable form
 --		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}