OS X 10.11 Not able to change the folder permission

I have root permission but still I am not able to change the folder permission

sudo chmod  -R 777 /Applications/Safari.app/Contents/MacOS/
chmod: Unable to change file mode on /Applications/Safari.app/Contents/MacOS/: Operation not permitted

But at the same time I am able to do

sudo chmod -R 777  /Applications/Firefox.app/Contents/MacOS/

System details:

ProductName: Mac OS X ProductVersion: 10.11.2 BuildVersion: 15C50

Could anybody help in identifying the issue?


Solution 1:

Some of the root folders (e.g. /sbin /bin) as well as some application bundles (i.e. Apple apps) are protected by System Integrity Protection even if logged in as root or using sudo.

If you want to make changes to protected items disable SIP, apply the changes and reenable it.