Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.
$ 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?

share|improve this question
1  
There's an in-depth answer to this on cnet. –  SSteve May 20 '12 at 6:43
1  
In Super User: What is a .lockfile? –  Graham Perrin Jan 26 '13 at 13:35
add comment

4 Answers 4

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.

share|improve this answer
add comment

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.

share|improve this answer
    
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 Aug 2 '11 at 1:46
add comment

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

share|improve this answer
add comment

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:

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.