Ehcho.com

Disable AirPlay Mirroring

By Morgan Rowe | 31 Jul 2013

Mac OS X Mountain Lion came with a great feature called AirPlay mirroring. It allowed most Macs created during 2011 or later to wirelessly stream their display to any AppleTVs connected to the same network as the Mac. This feature is useful at home but in a school or business environment, you may not want your users to do this.

Disable AirPlay Mirroring

Unfortunately, Apple hasn't provided an easy way to disable this functionality but we can use a satisfactory method to achieve this. In order to disable AirPlay mirroring, we have to deny the computer access to the application that allows the computer to AirPlay mirror.

We can do this by typing the following command into Terminal. Terminal can be found in /Applications/Utilities.

sudo chmod 000 /System/Library/CoreServices/AirPlayUIAgent.app/Contents/MacOS/AirPlayUIAgent

Press return and enter the local administrator password.

Restart the Mac and log back in.

If you try to AirPlay mirror to an AppleTV now, the AirPlay icon will stay blue, as if it's still trying to connect but it never will, therefore, disabling AirPlay mirroring.

Drawbacks

The only drawback to this method is that it locks up the menubar, which means your users won't be able to use any of the menu bar items. They're still able to adjust the volume using the keyboard, though. Logging out and back in will restore the functionality of the menubar until the user tries to use AirPlay mirroring again. I guess if your users complain about the menubar crashing, you know what they've been trying to do!

To remove your users temptation of crashing the menu bar all the time, you can hide the AirPlay icon by opening System Preferences > Displays and unchecking the "Show mirroring options in the menu bar when available" checkbox. However, this will only hide the AirPlay icon for that user so you'll need to copy the com.apple.airplay.plist file to all your users accounts. You can do this using Workgroup Manager.

Reenable AirPlay Mirroring

To reenable the AirPlay mirroring functionality, you can run the following command using Terminal.

sudo chmod 755 /System/Library/CoreServices/AirPlayUIAgent.app/Contents/MacOS/AirPlayUIAgent

This will restore the original permissions to the binary, allowing it to function normally. I always perform a restart after executing these sorts of commands.