Operation not permitted turning off airplay mirroring

You'll need to disable System Integrity Protection (SIP). It stops anything from modifying System files.

Disabling SIP: (more info in this article)

  1. Enter Recovery HD
  2. From the Utilities menu, select Terminal
  3. Type in csrutil disable

Turning Off Rootless System Integrity Protection in Mac OS X Again, the vast majority of Mac users should not disable rootless. Disabling rootless is aimed exclusively at advanced Mac users. Do so at your own risk, this is not specifically recommended.

Reboot the Mac and hold down Command + R keys simultaneously after you hear the startup chime, this will boot Mac OS X into Recovery Mode

When the “MacOS Utilities” / “OS X Utilities” screen appears, pull down the ‘Utilities’ menu at the top of the screen instead, and choose “Terminal”

Type the following command into the terminal then hit return:

csrutil disable

You’ll see a message saying that System Integrity Protection has been disabled and the Mac needs to restart for changes to take effect.

Then execute reboot and the Mac will then reboot itself automatically, just let it boot up as normal

http://osxdaily.com/2015/10/05/disable-rootless-system-integrity-protection-mac-os-x/

Hint: If it does not work on the first time, then close the terminal and reboot, then try again.

WARNING: You should enable it again once you are done, otherwise you are opening a big security hole.

Enable it with csrutil enable