Useful Tips

This feature of Mac computers will pleasantly surprise you.


MacOS developers have made the process of switching sound sources simple and convenient. There is a corresponding icon in the menu bar, you just need to click on it and specify the desired item.

Unfortunately, switching sound on any Mac with just one button or keyboard shortcut is not possible from the beginning.

There is a way to make this process as convenient as possible.

Why is it necessary

I agree that switching sources of sound is not necessary for everyone and not always. However, many Mac users often switch between headphones and speakers during the day, sometimes output sound to an external monitor or TV via HDMI, and include audio to Apple TV or speakers with AirPlay support.

And there are bluetooth headsets that can be paired with a computer, quickly switching to headphones for talking on Skype or FaceTime.

I use this daily, several dozens of times I have to switch from the headset to the external speakers, sometimes I switch the sound to a bluetooth headset or put it on an Apple TV.

How to set it all up

Do not be afraid of the list above, almost all of the above are already on every Mac, you don’t need to go into the jungle of settings or poke around on the command line.

1. First you need to download a set of additional utilities. We need a command line application switchaudio-osx, which allows you to control the sources of input and output sound. The utility is free and distributed on GitHub.

The easiest way to download it as part of a package Homebrew. This is a whole set of utilities that are useful for working and further configuring macOS. You can read more about it on the project website.

To download the package, open the application Terminal and paste the following code:

We see that the script will download several packages, confirm with the Return (Enter) key, enter the password for the macOS user and wait for the process to complete.

2. Now you need to install the downloaded utility switchaudio-osx. To do this, write the following command in the Terminal:

We are waiting for the installation to complete.

3. Run the utility with the command:

We see the possible keys for working with the utility. We are interested in launching a utility with the “-a” switch to display all sound input and output devices. We write in the terminal:

We remember the name of the necessary sound output devices.

4. Now launches the application Automator. Create a new one service, from the sidebar add Utilities - Launch Apple Script.

5. Select items above “No input” and “In any program”. Insert the following code below:

Instead of “Built-in Output” and “HDMI”, enter a pair of your output devices that you need to switch between (we looked at them in the previous paragraph).

To check here, we start the service by clicking on the icon with an arrow. If the source names are entered correctly, switching between them will occur.

If you wish, you can add one or more conditions to the code, so it turns out to switch round-by-round between several sources.

7. In Automator, select from the menu File - Save, enter the name of the service and remember it. Now our service has been added to the system. It remains only to set the keyboard shortcut for its launch.

8. Go to Settings - Keyboard - Keyboard shortcut. On the left we choose Services and look for the service you just saved.

We set a convenient key combination and use it. Do not forget that our service is universal and works in any application, regardless of context. In order for the switch to always work, you need to select a key combination that is not used in other programs.

That's all! You can test. Now during the game, watching videos, working in any application, you can instantly switch between sources of sound output.

What can be improved

In this process, only one thing is bad, if any of the output sources specified in the script is turned off, its operation will be interrupted.

For example, Apple TV, a wireless speaker or a bluetooth headset were indicated as one of the sources. While the device is connected, everything works, but when it is turned off or out of range of the Mac, the script will throw an error.

You can simplify our process, but make it more efficient. For this, only the following code can be used in Automator:

Running a command with the -n switch makes it easy to switch to the next available audio output device. Now we will switch between devices in a circle, if one of them is not connected when using the service, there will be no script error.

It remains only to make the switching process more visual. To do this, add another command:

It allows the system to identify the current device.

In Automator, we add two more actions: "Set the value of the variable" and "Show notification". In the first block, we assign any name to the variable, and in the second, we display this parameter in the message.

We save the script and check the operation of the service.

Now, when switching between sound output sources, we will receive a notification with the currently selected device. Simple and clear.

BetterTouchTool App Fans

Those using BetterTouchTool can add the appropriate script directly to the application. For this:

1. Launch BetterTouchTool settings.

2. Switch to the Keyboard section. You can bind the switch, for example, to the Apple Remote, for this we select the appropriate section.

3. Create a new event, add any button and select the “Run Apple Script” trigger.

4. We paste the code of our script (the first option with switching between specific sources or the second with cyclic switching).

This method is more convenient in that you can bind the switch not to a combination of keys, but to any one button. When using a full-sized keyboard with a numeric keypad, unused keys are enough for this.

In addition, BetterTouchTool will run the script even if the key is used by another program or system service. In this case, the application will take effect, and BetterTouchTool will launch the trigger we need.

This is how you can get a convenient tool for switching between sound output sources.

Thanks re: Store for the helpful tip.

(No votes)

Best commentary

This thing, at least to me, as a person who has long been working with different DAWs, has long been known. It was also due to this feature that the Mac won its place in music studios. And also Core Audio and a bunch of other goodies. 😉
It would be cool if you could connect two or three pairs of BT-headphones to the Apple TV and fork for everything at once. And it happens, in the evening someone is sleeping already, but I want to see a movie.

How to connect a Bluetooth speaker to Mac?

1. Turn on the power of the wireless speaker and put it into detection mode. This is usually done by pressing the power key or a special button with the Bluetooth icon.

2. On a macOS device, click on the  menu in the upper right corner and select System Preferences.

3. Go to the section Bluetooth.

4. In the panel that opens, enable the wireless interface if it is disabled. After a new item with a speaker icon appears in the device list, click on the button "Connect" on the right side of the line.

5. Wait a few seconds. After connecting the Bluetooth speaker, a small inscription appears in the list of devices below it "Connected".

After connecting the Bluetooth speaker, adjust the sound volume. This can be done both on the speaker itself and on the computer.

The easiest way to test the sound transmission is to open iTunes and play any song or watch some video on YouTube. Audio should flow to the wireless speakers.

In our example, the MacBook Pro is connected to an inexpensive, but fairly high-quality speaker system with AliExpress. It significantly exceeds the sound quality of the speakers built into the laptop.

How to disconnect a Bluetooth column from Mac (macOS)?

The easiest way to disconnect your Mac wireless audio device is to turn off the speaker power. But only when you turn it on again, the device will try to pair again. But if you don’t need to disconnect the speaker, and you still need it to connect via Bluetooth to your iPad or iPhone, you will have to cancel pairing with the audio device in the Mac menu bar or in the Bluetooth control panel.

1. On the macOS menu bar, click the Bluetooth icon.

2. In the device section, find the column you are using. When you click on it, a submenu will appear in which you need to click Disable.

Another way to turn off the speaker is to turn off Bluetooth on the Mac itself. But such a solution may not be practical, because many users use a wireless keyboard, mouse and other accessories.

How to remove (forget) a Bluetooth speaker on a Mac?

To prevent the Mac from connecting to a specific speaker again and not being detected anymore, you can turn off this audio device on your computer.

1. Open the  menu and select System Preferences.

2. Select the Bluetooth settings panel.

3. To the right of the name of the audio device, click the cross icon.

4. Confirm the removal of the connected speaker from the system.

Since the speaker is disconnected from the computer and removed from it, if you need to connect an audio device via Bluetooth, you will need to do the same steps above.

Set up audio devices on a Mac

  1. If necessary, install the software that came with your device (such as software drivers). If your audio device supports plug-and-play technology, you do not need to install a software driver on your Mac to work properly.
  2. Connect your audio device to your Mac.
  3. Go to the Apple menu ()> System Preferences and click Sound.
  4. Go to the “Input” tab and select the audio interface or audio line-in.

Mac audio streaming

For audio streaming, the AirPlay function is used.

Information about products not manufactured by Apple or independent websites not controlled and tested by Apple is not advisory or advertised by the company. Apple is not responsible for the selection, functionality, or use of third-party websites or products. Apple is also not responsible for the accuracy or reliability of data posted on third-party websites. Remember that using any information or products posted on the Internet is risky. Contact your supplier for more information. Other company or product names may be trademarks of their respective owners.