Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Editor or way to print plist in a clean way without Xcode

Tags:

xcode

plist

I need to share information from a plist with someone who is not technically inclined. Is there a common free editor that one can use to view plist info in a similar way in which it is presented in Xcode? Or is there a way to print it out?

In other words I would like to view the plist without all the xml-like mark up and without the use of Xcode.

like image 764
Eric Brotto Avatar asked Feb 28 '12 16:02

Eric Brotto


People also ask

How do I edit plist files on a Mac?

plist file. If you need to edit these items, Control-click (or right-click) Info. plist in the sidebar and select Edit Manually. This allows you to add or edit items in raw XML format.

How do I open a .plist file on a Mac?

You can also edit property list files in Xcode, which provides a built-in property list editor. To use Xcode, double-click a . plist file in the Finder. If you don't have Xcode installed on your Mac, download it from the Mac App Store.


1 Answers

Command-line options for viewing Plist files:

  • For viewing only: Use plutil -p, which prints the content of a property-list in JSON-like format (the format is meant for human consumption only).

Example (append | open -tf to view output in a text editor):

plutil -p ~/Library/Preferences/com.apple.sidebarlists.plist
  • Alternative: Use /usr/libexec/PlistBuddy -c print, which outputs in JavaScript-object-literal-like format:

Example:

/usr/libexec/PlistBuddy -c print ~/Library/Preferences/com.apple.airplay.plist

Caveat: If the plist has properties containing binary data, PlistBuddy will include it in raw form (by contrast, non-binary properties in the same file are printed properly). If XML output is desired, add option -x.

Note that PlistBuddy:

  • can be used to extract properties selectively using :-separated, case-sensitive property paths; e.g., /usr/libexec/PlistBuddy -c 'print :favorites:ShowRemovable' ~/Library/Preferences/com.apple.sidebarlists.plist
  • is also capable of modifying Plist files from the command line (including, with limitations, importing from previously exported-to XML files).

See /usr/libexec/PlistBuddy -h for details.

like image 112
mklement0 Avatar answered Oct 07 '22 01:10

mklement0