Auto mute macbook on headphone removal
Solution 1:
Unplug/disconnect your headphones, and mute the system volume. For added security, turn the volume all the way down. Plug in your headphones, and your volume should remain the same. The system will automatically switch between mute/no volume and the volume you have set for your headphones.
This is something that works on at least OSX 10.8 (I can't speak for sure on older versions of OSX), and a late 2008 or later Macbook. I tested it on both bluetooth and corded headphones.
Solution 2:
So I wrote a Mac app to do just that - automatically mute the volume when headphones get disconnected. It's called AutoMute and is available for $2.99 on the App Store, or you could just build from the source available on github for free.
Solution 3:
I like to use the ControlPlane app for this. An added bonus is you can do more than just mute/unmute, such as turning dock auto-hiding off or on depending on whether you have external monitors attached or not.
Here is the setup I use:
On the Contexts tab of ControlPlane's preferences, add a context named Headphones and another named Speakers.
On the Evidence Sources tab, ensure that the Audio Output evidence source is enabled
-
On the Rules tab, click the Add (+) button, select Add Audio Output Rule..., and set the following options:
a. Audio output going to: Internal speakers
b. Context: Speakers
c. Confidence: 100% (Drag slider all the way to the right)
-
Repeat step (3) with the following settings:
a. Audio output going to: Headphones
b. Context: Headphones
c. Confidence: 100%
-
On the Actions tab, click the Add (+) button, select Sound and Music Actions > Mute and set the following options:
a. Toggle muting of system audio: Mute system audio
b. at context: Speakers
c. On arrival
-
Repeat step (5) with the following settings:
a. Toggle muting of system audio: Unmute system audio
b. at context: Headphones
c. On arrival
If you would prefer to have a single context, you can get by with that as well by (for example) having a Headphones context with mute on departure from the context.
Solution 4:
I just heard about Breakaway which automatically disable the built-in speakers when headphones are removed (but only by manually connect/disconnect the jack), you should try it !
Some others (but non free) solutions would be to set up an automatic mute script whenever the audio output is changed with Keyboard Maestro or EventScripts
For exemple, with EventScript:
- Click on Open Folder from EventScripts menu in order to open the scripts folder.
- Add the script you want to be triggered, in your case something like
do shell script "osascript -e 'set volume 0'"
(note that set volume function works from 0 to 7, 0 being mute and 7 maximum volume). - Click on Choose Script from EventScripts menu and select the script to be used.
- Add the event Headphone disconnected.
See my own setup as exemple to quit or launch Boom whenever headphone or Bluetooth device (and you can choose wich device will trigger the script in bluetooth menu) is connected or disconnected: