sudo chmod: operation not permitted

Discussion in 'OS X' started by darakok, Dec 12, 2010.

  1. macrumors newbie

    Jul 21, 2010
    Dear mac users,

    I want to change permission on a file using this command below, but it doesn't work. it seems there is a permission problem or the file is locked in some way.

    what i get as a result is:
    sudo chmod g+rwx "Copy of index.php" 
    chmod: Unable to change file mode on Copy of index.php: Operation not permitted
    the error happens when i try to change file owner ship. There are other files in the folder, and my above command works except this one file.

    Please help.
  2. LPZ
    macrumors 65816

    Jul 11, 2006
    To test, I created a new file and then locked it. I then entered your command and received the same message you received. So it seems your guess about the file being locked is correct.

    You can try to unlock the file using Finder:

    1) In the Finder Go menu, choose Go to Folder.

    2) Type in the path to the folder that contains the file, and then click Go.

    3) In the window that opens, select the file and then select Get Info from the Finder File menu.

    4) In the panel that opens, uncheck the Locked box in the General section of the panel.

    (This can also be accomplished from Terminal using the SetFile command, but unless you've installed the Developer Tools, I don't think you have this command on your system.)
  3. macrumors 6502a

    Hal Itosis

    Feb 20, 2010
    SetFile (and Dev tools) not needed.

    chflags nouchg

    will do that trick as well (and chflags comes on all OSX Macs).


    Probably the most important command for users to learn is ls

    ls -lOe

    will show what's preventing the mode change.
    Could be a lock (flag) or could be an ACL too.
  4. LPZ
    macrumors 65816

    Jul 11, 2006
    Thanks. Sadly, I'll forget this before I need it again. :rolleyes:
  5. thread starter macrumors newbie

    Jul 21, 2010
  6. macrumors newbie

    Aug 28, 2012

Share This Page