Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

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:

http://reviews.cnet.com/8301-13727_7-20093292-263/lockfiles-and-other-plist-file-subtypes-in-os-x-lion/

share|improve this answer

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:

http://arstechnica.com/apple/reviews/2011/07/mac-os-x-10-7.ars/7#document-model

share|improve this answer
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

 
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.