Command to unlock "Locked" files on OS X
To unlock files you can use:
chflags -R nouchg /PATH/TO/DIRECTORY/WITH/LOCKED/FILES/
chflags
= change flags on files/folders such as "locked"-R
= recursive or for everything and follow directories within the specified directorynouchg
= means the file can be changed/PATH/
= of course is the path to the files you want to change. Something like:~/Sites/mysite/directory/with/locked/files/
works as well.
This is helpful if you want to search an entire directory and unlock all files.
In the terminal cd
to the directory
This command finds and will print a list of them.
$ find . -flags uchg
This command unlocks them.
$ find . -flags uchg -exec chflags nouchg {} \;
You can use the first command to double check that all the files are unlocked after running the second command, voilà !
You can also use SetFile -a l
, even though it does the same thing as chflags nouchg
:
SetFile -a l file.ext
-a l
unsets the bit for the locked attribute. You can install SetFile by downloading the Command Line Tools package from Xcode's preferences or from developer.apple.com/downloads.