Fixing file locks on OSX from the command line

Ran into a problem where a huge number of files copied from a Windows system to a removable drive on my Mac. The files could be read, but not modified in any way.

For example, if I attempted to run the command “chmod 755 filename” it would return “Operation Not Permitted.” Same if I attempted more mundane commands such as touch.

Turns out sometimes Mac sets the “locked” flag on these files. I can’t tell you why, but I can tell you it did. This flag is different than standard POSIX permissions and I could not see them from the command line.

After some Google searching and reading man pages, the fix is easy.

From the command line, switch the folder that contains your data (/Volumes/DriveName if it’s an entire drive) and type:

chflags -R nouchg *

Found this information here:

No comments yet.

Leave a Reply