Skip to content

Utility to convert plist files to yaml files or vice versa

License

Notifications You must be signed in to change notification settings

macjustice/plist-yaml-plist

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Convert plist <=> yaml

This utility is designed to convert Apple plist files to yaml, or yaml files to plist. I/O is from regular files.

Prerequisites

The python yaml module is required, which is not installed by default on Macs. You can install it with pip, which you may also need to install first.

sudo python -m ensurepip
pip install pyyaml

Usage

If all three files are in the same folder, a single command can be used to convert in either direction:

./plistyamlplist.py -h
Usage: ./plistyamlplist.py <input-file> [<output-file>]

Otherwise, each file can be used individually:

./plist_yaml.py -h
Usage: plist-yaml.py <input-file> [<output-file>]

./yaml_plist.py -h
Usage: yaml-plist.py <input-file> [<output-file>]

Notes:

  1. With plistyamlplist.py, if you do not specify an output-file value, the script determines if the input-file is a plist or yaml file. If a plist file, the input-file name will be appended with .yaml for the output file. If a yaml file, the output file name will be the input-file name with .yaml removed.
  2. With plist_yaml.py, if you do not specify an output-file value, the input-file name will be appended with .yaml for the output file.
  3. With yaml_plist.py, if you do not specify an output-file value, and the input-file name ends with .yaml, the output file name will be the input-file name with .yaml removed.
  4. With plist_yaml.py, you may have to first convert a binary plist to text format using plutil.

Examples

To convert a plist file to yaml:

$ plutil -convert xml1 ~/Library/Preferences/com.something.plist
$ ./plistyamlplist.py ~/Library/Preferences/com.something.plist ~/Downloads/com.something.yaml
$ ./plistyamlplist.py ~/Library/Preferences/com.something.plist
# this will output to `~/Library/Preferences/com.something.plist.yaml'

To convert a yaml file to a plist file:

$ ./plistyamlplist.py ~/Downloads/com.something.yaml ~/Downloads/com.something.plist
$ ./plistyamlplist.py ~/Downloads/com.something.plist.yaml
# this will output to `~/Downloads/com.something.plist'

Credits

Elements of these scripts come from chaimleib/ppl and asciidoctor/sublimetext-asciidoc

About

Utility to convert plist files to yaml files or vice versa

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%