14
$ cd ~/Library/Preferences
$ ls -1 | grep plist | head -10
AddressBookMe.plist
com.adiumX.adiumX.plist
com.adiumX.adiumX.plist.lockfile
com.apple.AddressBook.plist
com.apple.AddressBook.plist.lockfile
com.apple.BezelServices.plist
com.apple.BezelServices.plist.lockfile
com.apple.BluetoothAudio.plist
com.apple.Console.LSSharedFileList.plist
com.apple.Console.LSSharedFileList.plist.lockfile

what are these lockfiles for?

2

4 Answers 4

8

Apple supplies a Core Foundation Preference Services API to developers that makes it easy for them to manage preferences. Apple uses the same API and these lock files help the system know what programs are writing to the files and it helps the system notify the running program when a setting gets changed.

The system will keep track of a file that's open even if you trash and delete it, but it's probably best to leave these alone (like most of ~/Library) as there's no undo for things that are stored there - they are there to support the "undo" of the rest of the system.

1

Lockfiles are used to make sure only one app interacts with a preference file at once. The idea is an app opens the lockfile in an exclusive mode while it opens the plist.

Source:

0

Purely guesswork unfortunately, but typically lockfiles are there to stop a file being edited by more than one thing at a time and causing corruption.

However if you run fs_usage on your Mac to watch filesystem activity nothing much seems to touch these files. The Finder seems to read through them all occasionally but that seems to be it, even if you change preference settings in various applications.

1
  • when you quit an app the lockfile isn't gone though. rm'd them all, them only seem to be recreated on app launch. Changing prefs for an app does not recreate them.
    – kch
    Commented Aug 2, 2011 at 1:46
0

Have you noticed if you can make settings changes to applications? I'm seeing these lockfiles also and preferences are not being saved to the plist files.

UPDATE: I discovered that a previous ACL was in place that prevented me from making changes to application settings. By removing the ACLs using chmod -R -N on my home folder I am now able to make changes that are saved.

Kent

You must log in to answer this question.

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