Editing a system preferences .plist file (not user preferences .plist file)

plist

I'm using an app that has .plist files in the user path ~/Library/Preferences/com.xyz.app.plist and the system path /Library/Preferences/com.xyz.app.plist

From the command line I can edit the user .plist with defaults write com.xyz.app.plist key value

But how do I edit the system .plist file from the Command line?

Using "sudo" with the defaults command didn't work. In fact, it didn't seem to have any effect at all.

Editing it in Xcode isn't preferable, but I can't do it there either. Using Xcode, I can bring up the system .plist file. But it's not letting me edit saying it's locked and not letting me unlock in Xcode.

I've also chmod 666 the system .plist file from 644, with no effect on editing from the command line or Xcode. I've started Xcode under root, and it still had the same issue with the file being locked.

How do I edit this system .plist file (preferably from the command line)?

Best Answer

defaults can also work on plist files specified on the command line, so you can use

sudo defaults write /Library/Preferences/om.xyz.app.plist key value