Skip to content

Instantly share code, notes, and snippets.

@chrisgeo
Created March 18, 2015 20:26
Show Gist options
  • Save chrisgeo/80ed5e83188f0261b171 to your computer and use it in GitHub Desktop.
Save chrisgeo/80ed5e83188f0261b171 to your computer and use it in GitHub Desktop.
Enable and Disable Airplay Script
#! /bin/sh
#######
#
# Script to enable and disable airplay in OS X
#
#########
AIRPLAY=/System/Library/CoreServices/AirPlayUIAgent.app/Contents/MacOS/AirPlayUIAgent
disable() {
echo "Disabling airplay\n"
sudo chmod 000 $AIRPLAY
}
enable(){
echo "Enabling Airplay Agent\n"
sudo chmod 755 $AIRPLAY
}
status(){
stat=`stat -f %p $AIRPLAY`
if [[ stat -eq '100755' ]] ; then
echo "Airplay is enabled\n"
elif [[ stat -eq '100000' ]] ; then
echo "Airplay is disabled\n"
fi
}
case $1 in
enable)
enable
;;
disable)
disable
;;
status)
status
;;
*)
echo "Commands to use enable|disalbe"
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment