What are the .lockfiles (for example, in ~/Library/Preferences) in OS X Lion for? I didn't seem to see them in Snow Leopard. Do they impact modifying other files in any way?

And how do you open these lockfiles?


Lockfiles are used to restrict editing of another file (ostensibly a document or resource) while an application has said document or resource open. This is so that only one application can write to a file at a given time.

You cannot open a lockfile, nor would you as the user ever need to. On some systems, they are empty files, and so there's nothing to see anyways. The exact implementation on OSX Lion is described here:



I believe it is actually more related to the built in version control thats new in Lion. Its probably the most recent snapshot of the file. That's probably why they hid the library folder by default in this release. John Siracusa explains the internals in great detail here in his review on Ars Technica:


  • 1
    The built in version control may be why it's there, but from what I read (I unfortunately don't have the time right now to read the whole section), I'm still inclined to say that the lockfiles are being used for their traditional purpose. Having 2 apps reading the same file is fine, but having 2 apps writing to the same file is dangerous.
    – MBraedley
    Jul 26 '11 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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