Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Edit plist with Bash/Applescript

Hi community,


Is there a way to edit plists without the use of Apple Developer's Property List Editor or any other software that doesn't come preinstalled on the Mac OS? Even better, is there a way to automate with the use of Applescript (or if not, Bash)? Any help is appreciated. Thanks.

Posted on Aug 3, 2011 1:58 PM

Reply
Question marked as Best reply

Posted on Aug 3, 2011 2:03 PM

The defaults Terminal command can be used to read and edit a plist. Some entries are structured in such a way that they can basically only be edited from a GUI application.


(59859)

3 replies

Aug 3, 2011 4:09 PM in response to chumponimys

the System Events app (installed on all systems since 10.3, I think) has a property list suite that allows automated editing of property list files. it works like so (this sets a text item called 'x' in an array called 'array name' in a plist file at '/path/to/file.plist' to the value "..."):


tell application "System Events"

set plistFile to property list file "/path/to/file.plist"

tell plistFile

tell property list item "array name"

set value of property list item "x" to "..."

end tell

end tell

end tell


you can get more information at MacOSXAutomation

Edit plist with Bash/Applescript

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.