Every time I connect a Bluetooth device, headphones or speakers, the output switches to the new device.

This is fine, however, the input also switches.

I would prefer for the microphone input to never switch.

How can I permanently set a 2013 MacBook Pro Microphone to onboard hardware mic?

Also, if there is a way to switch inputs via AppleScript or Alfred workflow, I would love to try them out.

  • 3
    I saw your edit and added the AppleScript code to make it happen. Hopefully, that's what you are looking for.
    – ProGrammer
    Commented Feb 8, 2018 at 11:16

2 Answers 2


Right now, to the best of my knowledge, it is not possible to prevent the input/output switching between external devices and the onboard instruments using built-in features from the Operating System. I have added a simple trick (that you may already be aware of) to switch between input devices quickly and given an explanation as to why macOS behaves this way. I may not be the answer you are looking for but I wanted to share this information with you anyway, in the hope that it shows the problem from a different perspective or somebody is able to add to my thinking.

Input switching occurs when the new input/output device has microphone capabilities, which (in theory) gets the mic closer to the user thus produces greater audio and reducing background noise through less distance between the source and the mic - as the majority of headphones/earphones do with a built-in mic. This is how Apple views it and most customers don't want to put up with picking the right source every time they connect a pair of headphones.

Why might it be a positive?
Unlike in the Windows world, where a Default Device can be set in the Sound Settings, Macs (unlike PC's) have a built-in speaker and microphone in pretty much every single (recent) computer ever released. Microsoft does not restrict Windows to a select group of systems (the way macOS only works on an Apple device, with the exception of unsupported Hackintosh builds). That is a major factor in the lack of flexibility when it comes to different ways of settings the input devices because if Apple knows an interface exists, it becomes the default (and fallback) interface - there would be no reason to think otherwise.

Apple, known for its user experience, has decided that for the majority of its customers, the headphone goes into the socket, it detects whether it has microphone capabilities, switches inputs accordingly and is in that way able to deliver and send clearer audio between the mac and the headset (the headset presumably being closer to the user now than the onboard microphone).

A Common Workaround
The most common (and simplest) trick is to adjust the sound I/O interfaces themselves by switching to the desired device(s) through the menu bar.

  1. Find the Speaker icon in the menu bar (if not present, go to: System Preferences > Sound > Check/Enable: Show volume in menu bar.
  2. Hold the Alt/Option key and click on the Speaker icon in the menu bar.
    Speaker icon in the menu bar
  3. You will now be able to switch between the devices as required. It may cost you a second or two of your time but it is by far a better alternative to messing with the system in other ways that may produce unknown side effects.

I hope I was able to shed some light on Apple's way of appealing to the majority and the reason why they believe auto switching is better than the manual way. I understand this is a rather long-winded explanation of a simple no but it was important to get the point across anyway.
Maybe you, like me, are able to forgive Apple for making an inflexible choice in their OS design that disregards a portion of the market's needs. I never found a reliable piece of software to prevent the switching so I learned to live with the quick menu bar trick and never let it bother me again. Maybe one day Apple adds a preference for preventing auto-switching of inputs.

Let me know if that was helpful in any way or if you have any other questions, I'd be more than happy to follow up with you on this.

Is there a way to switch inputs via AppleScript?
Absolutely, there is! Let me show you how.


tell application "System Preferences" to activate
tell application "System Preferences"
    reveal anchor "input" of pane id "com.apple.preference.sound"
end tell
tell application "System Events" to tell process "System Preferences"
    tell table 1 of scroll area 1 of tab group 1 of window 1
        select (row 1 where value of text field 1 is "Line In") --> Or change to "Internal Microphone"
    end tell
end tell
quit application "System Preferences"

What next?
You will need to allow the ScriptEditor to control your computer. Go to System Preferences > Security & Privacy > Privacy > Accessibility, then add the ScriptEditor/Compiled script to this list. This is an essential (security) step because your script is manipulating the GUI and in a way intercepting the window events. If you have no clue what any of that means, don't worry now, just paste the code into your ScriptEditor and run it - an error will tell you if anything was not done properly.

Potential Improvements
I'll leave you to your imagination but you could very easily make a toggle switch script (although the before mentioned menu bar trick pretty much does this already). One suggestion might be to find the Terminal equivalent and simply run a do shell script command through AppleScript. Such would involve looking for the .plist file which contains the current state (input selection) of the Sound Preferences and manipulating it to your choice. This is highly OS-specific and has a tendency to require the user to log out for the changes to take effect. With that method, I think we are simply looking for trouble where we don't need it. As the age-old KISS principle states: "Keep it simple, stupid" - sometimes it's just better to do the simplest task that anyone without the technical knowledge (AppleScript/Terminal) can achieve.

  • 1
    Thanks for the response, it was very thoughtful. Leaving The question open for now to see if there is other ideas Commented Feb 6, 2018 at 23:37
  • 1
    wow, thanks for the update - i'm trying out the script now but running into this issue: i.imgur.com/Yly27mf.png - the preferences window open but it fails to make the switch Commented Feb 8, 2018 at 14:49
  • 2
    Here we go - i modified your original script a bit, this is working for me: gist.github.com/lfender6445/d8361e084057214798a1ccb0cbea32ac Commented Feb 8, 2018 at 15:12
  • 6
    really helpful option + speaker icon on top right in menubar
    – IsmailS
    Commented Nov 5, 2020 at 19:56
  • 2
    Yeah @IsmailS option + menu bar is almost as good as having this happen permenantly
    – nmu
    Commented Oct 18, 2022 at 16:04

I found a workaround that fixed it for me. OBS (free streaming software) appears to be able to assign a default input device. It works for me system-wide and even when OBS is not running.

  1. Install OBS

  2. Provide OBS with the permissions it requests during setup.

  3. In the Audio Mixer section of the main page you should see Mic/AUX. Hit the three-dot Menu > Properties > Device.

Screenshot of OBS software with the Mic/Aux menu highlighted

  1. Select the device you want as your default.

You must log in to answer this question.

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