Reading OS X plist files (Command line)

OS X uses plist files to store configuration information - you can think of them as OS X's version of the windows registry. There are a number of tools to edit and read .plist files.  Here is some tools that I use that work from the command line.

To read a plist you can use:

defaults read /Library/Preferences/

and similarly to write a value to a plist

sudo defaults write /Library/Preferences/ SomeKey -bool TRUE
sudo defaults write /Library/Preferences/ SomeKey -string "somevalue"

and delete

sudo defaults delete /Library/Preferences/ SomeKey

You can also use plutil to dump an XML version to stdout:

plutil -convert xml1 -o - filename.plist

as well as convert between binary and XML formats. Xcode also ships with a plist editor (standalone prior to XCode 4, built-in since then).

And if that wasn't enough there's also PlistBuddy, here's an example command to print a particular key 'BluetoothVersionNumber':

/usr/local/bin/PlistBuddy -c Print:BluetoothVersionNumber /Library/Preferences/