2

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)?

4
  • The defaults write... command you cited is editing the file from the command line, so I’m not understanding what you mean by “edit from the command line.” The fact that it has no effect could mean that whatever you’re writing has no relevance. For instance, I can issue the command defaults write com.apple.powersave hamsters bool 1 to turn on the hamster power boost feature, but since it hasn’t been implemented, you’re not going to see anything.
    – Allan
    Commented Jul 10, 2020 at 22:05
  • So....what exactly are you trying to accomplish? What do you want to edit and why? What command, exactly, are you issuing?
    – Allan
    Commented Jul 10, 2020 at 22:05
  • I want to edit the system .plist file /Library/Preferences/com.xyz.app.plist, not the user ~/Library/Preferences/com.xyz.app.plist. defaults write... is only editing the user file. The setting I want to edit is unimportant - I just want to be able to make any change to the system .plist file.
    – DDx
    Commented Jul 10, 2020 at 22:21
  • If you’re using catalina, the system volume is read only. Also, have you looked at the plutil utility?
    – Allan
    Commented Jul 10, 2020 at 22:43

2 Answers 2

2

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
0

I use BBEdit for modifying plist files in /Library/Preferences, which has the advantage of handling the authorization needed to obtain write permission, and then save the files with their original attributes.

4
  • doesn't work anymore - the system plist files are locked and BBEdit cannot unlock them.
    – zaam
    Commented Oct 3, 2023 at 1:34
  • @zaam It works for me. What's the path of the file you're trying to open?
    – benwiggy
    Commented Oct 3, 2023 at 6:44
  • Sorry, it unlocks but I can't edit it. I'm trying to change /Library/Preferences/com.apple.networkextension.plist to get rid of a stray VPN entry
    – zaam
    Commented Oct 3, 2023 at 12:47
  • It's to do with SIP. Seems like SIP was blocking all the edits. Fixed it now. Thanks.
    – zaam
    Commented Oct 3, 2023 at 13:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .