28

I often listern to music on my macBook - when I unplug my headphones occasionaly forget to mute the speaker - so the whole office gets an earfull. How can I set my mac to be muted unless headphones are plugged in. I'm interested to know if I can simply deactivate the built in speakers...

This has become more obvious recently when I use a bluetooth headset or similar - I walk away from the machine forgetting the headset is attached and as soon as I get far enought away my computer starts making noise....

4 Answers 4

28

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.

2
  • No idea why I hadn't accepted this orginally, thank you for waiting... :)
    – Joe
    Sep 11, 2018 at 8:14
  • 5
    This operation has to be performed each time when you listen to the speakers. Personally, I always forget to do it. Still looking for an automated solution. Dec 24, 2018 at 13:06
13

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.

5
  • doesn't work for me when I remove my airpods off the ears. macOS Mojave 10.14 Dec 24, 2018 at 13:03
  • Sorry to hear that, I'm afraid I don't have AirPods to test with, but this project is now open source, so anyone with AirPods- feel free to contribute: github.com/yonilevy/automute
    – yonilevy
    Dec 30, 2018 at 19:37
  • it is not for free but for $2.99 :D May 2, 2019 at 10:26
  • @Lukᚊálek thanks for pointing it out, I made that change a week ago :) It's still open source and easy to build with XCode, I'll update the answer.
    – yonilevy
    May 4, 2019 at 15:24
  • Really appreciate @yonilevy making automute open source with a very liberal license. I'm now releasing binary builds that are unsigned available here: github.com/nnathan/automute/releases/latest -- there's still futzing around to get things working because of security settings - so the best choice is to install from app store. But this is for anyone who simply doesn't want to pay.
    – snap
    Jun 5, 2019 at 15:19
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:

  1. On the Contexts tab of ControlPlane's preferences, add a context named Headphones and another named Speakers.

  2. On the Evidence Sources tab, ensure that the Audio Output evidence source is enabled

  3. 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)

  4. Repeat step (3) with the following settings:

    a. Audio output going to: Headphones

    b. Context: Headphones

    c. Confidence: 100%

  5. 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

  6. 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.

1

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:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .