Tuesday, December 10, 2013

How to Unlock a "stuck" in Lock file on Mac OS X

I recently copied a file over the network from my Win8 machine to my Mac.

I then went to delete the file, but the system wouldn't let me stating that the file was locked, giving me the error message:

"The operation could not be completed because the item '(item name)' is locked."

I checked the standard approach to solve a file issue, using the GET INFO option on the file.  However, the check box to unlock the file was greyed out.  

So a bit of trial and error, and I found that if you have the developer tools, you can easily do this from the command prompt.

Open up a terminal and change directories to the location of the locked file.

at the terminal prompt, type
/Developer/Tools/SetFile -a l filename   (that is a lowercase "L" not a pipe "|")

To unlock all the files in the current directory, use a *

/Developer/Tools/SetFile -a l *

Voila!