MacOS – How to unlock a .plist file in /private/var/db/receipts so that I can change it

findermacospermissionplistxcode

I want to edit some com.myApp.plist. I'm running OS 10.10.3, and I do have Xcode installed. But every time I try to edit the file, it's locked and I can't save my changes.

If I try to save it with Xcode, Xcode asks if I want to unlock it. I say "Unlock", but then an error says The file "com.myApp.plist" could not be unlocked."; it says that this is because I do not own it.

If I open the file in Sublime Text, its just the object code.

How can I make changes to the file?

I have tried sudo chown $USER com.myApp.plist followed by sudo chmod u+w com.myApp.plist. They both succeed but I still can't edit the file.

I have tried using Finder to change each folder in the path to add me as a read/write user, but still no editing capability.

I have tried opening the file from Terminal using sudo com.myApp.plist which opens Xcode. Doesn't work.

Not sure what else to do. I could try something like "apply to enclosing folders" but that seems dangerous.

Best Answer

The main reason that chmod didn't remove the lock is because you didn't have permission in the enclosing folder. It's like in a real world example: You cannot access a package in a room that you can only see to, and don't have the keys to.

Simple Answer:

Click once on the file, copy it. Then paste it into your desktop. Edit it. The lock will not be there. Then, just plop it back into private/var/db This will ask for your admin authentication.

Less simple answer with use of terminal:

Before you dive in, make sure you edit every path to the path that your .plist is actually in

First, get info on enclosing folder, say that it is right in /private/var/dbThen db would be the enclosing folder So:

chmod -R 777 /private/var/db

Then Open up terminal and execute:

sudo chmod 777 /private/var/db/somefile.plist