How do I edit an Info.plist file?

I want to edit three lines of file

enter image description here

Whenever I try to edit it this comes up

enter image description here

I already gave myself permission to Read & Write (I'm 21muffinp)

enter image description here

The same thing still comes up, saying I do not have perimission.


Solution 1:

You need read/write permissions to the containing folder as well as the plist itself for Xcode to modify the file in place.

A workaround for this if you are unable to change the permissions of the containing folder is to copy the file out, edit it, then copy it back over the top of the existing file. Alternatively, you can use a different property list editor such as the CLI ‘defaults’.

Solution 2:

As already mentioned, you will need write permissions for the folder as well as the file. You can't write on a bit of paper that's stored in a room you can only see in to. ;)

Another workaround is to use an editor such as BBEdit (or TextWrangler if you don't need all the features) which will elevate to the correct privileges for you when you attempt to edit the file. Make sure you download the non-App Store versions of these apps, however, otherwise you won't have the option to elevate (because of Apple's sandboxing restrictions for MAS apps).

If you're okay with using Terminal, take a look at using PlistBuddy (which can be accessed at /usr/libexec/PlistBuddy) to edit your .plist files. I prefer it to defaults because it allows you to really drill down in to dicts and arrays when you need to (defaults has an issue with nested keys). Make sure you run it with sudo though otherwise you'll still have permissions problems.

EDIT: The above still holds somewhat true in 2021, but you may find that the BBEdit/TextWrangler approaches don't work for some newer .plist files due to the fact that binary PLists are preferred over the older XML-based PLists. (Full disclosure: I haven't worked directly with PLists for a few years now.) You can, however, manipulate binary PLists with a VSCode plugin so it might be worth checking that out if you want a modern GUI approach.