···11+.\"Copyright (c) 1999-2012 Apple Computer, Inc. All Rights Reserved.
22+.\"
33+.\"This file contains Original Code and/or Modifications of Original Code
44+.\"as defined in and that are subject to the Apple Public Source License
55+.\"Version 2.0 (the 'License'). You may not use this file except in
66+.\"compliance with the License. Please obtain a copy of the License at
77+.\"http://www.opensource.apple.com/apsl/ and read it before using this
88+.\"file.
99+.\"
1010+.\"The Original Code and all software distributed under the License are
1111+.\"distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1212+.\"EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1313+.\"INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1414+.\"FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1515+.\"Please see the License for the specific language governing rights and
1616+.\"limitations under the License.
1717+.Dd February 19, 2007
1818+.Dt PLISTBUDDY 8
1919+.Os "Mac OS X"
2020+.Sh NAME
2121+.Nm PlistBuddy
2222+.Nd read and write values to plists
2323+.Sh SYNOPSIS
2424+.Nm
2525+.Op Fl cxh
2626+.Ar file.plist
2727+.Sh DESCRIPTION
2828+The
2929+.Nm
3030+command is used to read and modify values inside of a plist. Unless specified by the
3131+.Fl c
3232+switch,
3333+.Nm
3434+runs in interactive mode.
3535+.Pp
3636+The following commands are used to manipulate plist data:
3737+.Bl -tag -width "Clear Type"
3838+.It Sy Help
3939+Prints this information.
4040+.It Sy Exit
4141+Exits the program. Changes are not saved to the file.
4242+.It Sy Save
4343+Saves the current changes to the file.
4444+.It Sy Revert
4545+Reloads the last saved version of the file.
4646+.It Sy Clear Ar type
4747+Clears out all existing entries, and creates root of type
4848+.Ar type .
4949+See below for a list of types.
5050+.It Sy Print Op entry
5151+Prints value of
5252+.Ar entry .
5353+If an entry is not specified, prints entire file. See below for an explanation of how entry works.
5454+.It Sy Set Ar entry Ar value
5555+Sets the value at
5656+.Ar entry
5757+to
5858+.Ar value .
5959+.It Sy Add Ar entry Ar type Op value
6060+Adds
6161+.Ar entry
6262+with type
6363+.Ar type
6464+and optional value
6565+.Ar value .
6666+See below for a list of types.
6767+.It Sy Copy Ar entrySrc Ar entryDst
6868+Copies the
6969+.Ar entrySrc
7070+property to
7171+.Ar entryDst .
7272+.It Sy Delete Ar entry
7373+Deletes
7474+.Ar entry
7575+from the plist.
7676+.It Sy Merge Ar file Op entry
7777+Adds the contents of plist
7878+.Ar file
7979+to
8080+.Ar entry .
8181+.It Sy Import Ar entry Ar file
8282+Creates or sets
8383+.Ar entry
8484+to the contents of
8585+.Ar file .
8686+.El
8787+.Pp
8888+Entries consist of property key names delimited by colons. Array items are specified by a zero-based integer index. Examples:
8989+.Pp
9090+ :CFBundleShortVersionString
9191+ :CFBundleDocumentTypes:2:CFBundleTypeExtensions
9292+.Pp
9393+Entries may be of the following types:
9494+.Pp
9595+ string
9696+ array
9797+ dict
9898+ bool
9999+ real
100100+ integer
101101+ date
102102+ data
103103+.Sh OPTIONS
104104+.Bl -tag -width "-c command"
105105+.It Fl c Ar command
106106+Execute command and exit. By default, PlistBuddy will run in interactive mode.
107107+.It Fl x
108108+Output will be in the form of an xml plist where appropriate.
109109+.It Fl h
110110+Print the complete help info.
111111+.El
112112+.Sh EXAMPLES
113113+.Pp
114114+Set the CFBundleIdentifier property to com.apple.plistbuddy:
115115+.Vb 1
116116+.Pp
117117+\& Set :CFBundleIdentifier com.apple.plistbuddy
118118+.Ve
119119+.Pp
120120+Add the CFBundleGetInfoString property to the plist:
121121+.Vb 1
122122+.Pp
123123+\& Add :CFBundleGetInfoString string "App version 1.0.1"
124124+.Ve
125125+.Pp
126126+Add a new item of type dict to the CFBundleDocumentTypes array:
127127+.Vb 1
128128+.Pp
129129+\& Add :CFBundleDocumentTypes: dict
130130+.Ve
131131+.Pp
132132+Add the new item to the beginning of the array:
133133+.Vb 1
134134+.Pp
135135+\& Add :CFBundleDocumentTypes:0 dict
136136+.Ve
137137+.Pp
138138+Delete the \s-1FIRST\s0 item in the array:
139139+.Vb 1
140140+.Pp
141141+\& Delete :CFBundleDocumentTypes:0 dict
142142+.Ve
143143+.Pp
144144+Delete the \s-1ENTIRE\s0 CFBundleDocumentTypes array:
145145+.Vb 1
146146+.Pp
147147+\& Delete :CFBundleDocumentTypes
148148+.Ve
149149+.Pp
150150+.Sh EXIT STATUS
151151+.Nm
152152+command returns a zero exit status if it succeeds. Non zero is returned in case of failure.