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 Top-ranking reply

Posted on Aug 3, 2011 4:09 PM

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

3 replies
Question marked as Top-ranking reply

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

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

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 Account.