OSX Operation Not Permitted on Immutable flag

Posted on


Anyone know super command for replacing locked .plist?
I have locked desktop.plist (immutable flags) needs to replace with a new desktop.plist.
Problem is unable to replace the existing .plist. I get error “Operation Not Permitted” It is impossible to apply chflags nouchg to multiple Macs and users. Can anyone help please!


There’s no way around it, you need to unlock the file (e.g. with chflags nouchg) first in order to change/replace it. Or, to put it another way, the “super command” you need is:

super_cp() {
    chflags nouchg "$2"    # Unlock the file to allow replacement
    cp "$1" "$2"           # Replace the file
    chflags uchg "$2"      # Relock the replacement

super_cp newdesktop.plist desktop.plist

Leave a Reply

Your email address will not be published. Required fields are marked *