Unlocking locked files in Mac OS

Let's say you are trying to change the permissions of some files (using chown or chmod), but you get an error:

Operation not permitted

Apple and Mac IT SupportThis is (in most cases) because the files are locked (you can verify that by going to "Get Info" for each file or directory). One way to solve it is to go through the list of permission errors and manually unlock them using Finder. A quicker way is to do it on a command line:

chflags -R nouchg /Users/macmac/Documents

This will allow all files in the directory "Documents" to be changed. You can then run chmod or chown on "Documents" and will not receive the error.

Options description for chflags:

-R = recurse into directories (careful with this option, because you will change everything underneath it)
nouchg = allow for file/directory to be changed

chflags -R nouchg 
Last Updated on Monday, 08 May 2017 23:04