OSX – remove readonly/locked flag
August 28th, 2013 // 8:50 pm @ Erik Westermann
The ‘locked’ flag in Mac OSX is the equivalent of ‘readonly’ on Windows.
I had a situation where I needed to remove the locked flag for a large number of files and folders within another folder. Using Finder’s Get Info command was not going to help since I needed to remove the Locked flag from sub-folders too.
I finally managed to figure it out:
- Open a Terminal window
- Change to the folder you need remove the Locked attribute
Look at the top of your Finder window and type ‘cd’ (without the quotes) followed by the path you see at the top of Finder.
- Type the following command:
sudo chflags -R nochg .
Note that case counts – so the R needs to be in upper-case
Here’s a breakdown of the command:
sudo – work as an administrator
chflags – change a file’s flags
-R – recurse through files and folders – this causes the command to work on all files and folders (and their subfolders too)
nochg – set the ‘chg’, or Locked attribute, to removed (chg with the ‘no’ prefix removes the chg attribute)
. – the current folder and below
Glad it works!
Category : Blog