OSX – remove readonly/locked flag

OSX – remove readonly/locked flag

August 28th, 2013 // 8:50 pm @

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:

  1. Open a Terminal window
  2. 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.

  3. 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

Comments are closed.

Latest Posts


"Erik excels in roles that require technical creativity and innovation. He is one of the very few people for whom technology is a way of life. Staying abreast with the latest and the greatest comes naturally for him. I found him to be very meticulous about the smallest technical details on projects while maintaining sight of the greater goal. I found him to be a great mentor to junior technical resources and very good writer."

P Kumar