68

I have a Early 2011 Macbook Pro 13" running OS X 10.10.1 (Yosemite).

At work, I have a Apple Magic Trackpad and an Apple Wireless Keyboard, both which use Bluetooth. When I get to work, my Mac automatically connects to both of them (if Bluetooth is on).

At home, I have a Belkin F8Z492-P Bluetooth Audio Adapter hooked up to my stereo (sorry, no product page available). If Bluetooth is on, my audio will automatically be routed to the Bluetooth adapter (which is something I rarely want).

How can I make OS X automatically connect to my trackpad and keyboard at work but not automatically connect to the bluetooth audio adapter at home?

Currently, I shut Bluetooth off when I get home, but I'd like to avoid toggling Bluetooth when I get home/when I get to work, since it is quite annoying to start typing on the wireless keyboard and have nothing happen, or not have audio when I get home.

If this is not possible, can I prevent OS X from switching my audio automatically when connecting to the Bluetooth audio adapter?

2
  • 1
    I'd rather not have to un-pair and re-pair it when I want to use it, since the actual adapter is in an inconvenient place.
    – Batman
    Dec 5, 2014 at 16:27
  • Not only does it do this when the Macbook is asleep, it also opens iTunes (which I don't use), and there could be ~3 different devices connecting to the speaker when I switch it on, leading to the hilarious "who is hijacking my speaker?" game.
    – contrebis
    Dec 4, 2016 at 20:46

4 Answers 4

71

I had the same problem and FINALLY found a workable solution. Run this in your terminal. After this you just need to manually connect to your bluetooth audio system.

sudo defaults write /Library/Preferences/com.apple.Bluetooth.plist DontPageAudioDevices 1
12
  • 2
    For clarity, your Mac will not auto-connect to audio devices but will continue auto-connecting to other devices, right?
    – Merchako
    Jul 15, 2017 at 5:36
  • 1
    Exactly, so for example my mac will still automatically connect to my keyboard and mouse but if I want to connect to my stereo I need to manually select it from the bluetooth list of devices.
    – Matt
    Jul 16, 2017 at 19:25
  • 5
    I would be so delighted if this worked for me. Unfortunately, it does not! While this might have worked for earlier OSX versions, I am finding that on Sierra 10.12.16, it has no noticeable effect after setting the plist value as described above. I even confirmed the value after a reboot and it reported back as 1 via defaults read /Library/Preferences/com.apple.Bluetooth.plist DontPageAudioDevices Jan 8, 2018 at 15:18
  • Doesn't work for me either, and now I can't downvote the answer anymore. Gaah.
    – ssssaaaa
    Mar 15, 2018 at 13:48
  • 2
    Correction: It started working after I restarted my computer today.
    – ssssaaaa
    Mar 25, 2018 at 10:02
16

Adding MAC address of a device to IngoredDevices disables auto connect of Bluetooth. To do so follow these steps:

  1. disable Bluetooth.

  2. find MAC address in DeviceCache with following command

    sudo defaults read /Library/Preferences/com.apple.Bluetooth.plist DeviceCache
    
  3. add MAC address to IgnoredDevices

    sudo defaults write /Library/Preferences/com.apple.Bluetooth.plist IgnoredDevices -array-add '<MAC ADDRESS>'
    
  4. print contents of the file, you should see there MAC address which has been added in step 3

    sudo defaults read /Library/Preferences/com.apple.Bluetooth.plist IgnoredDevices
    
  5. restart your Mac

  6. enable Bluetooth

This should work on Mojave and Catalina.

7
  • Will this prevent the device from being manually connected to?
    – rattray
    Feb 28, 2020 at 18:00
  • 1
    Sadly, this gets reset if you have Apple BT devices connected via USB and turn on Bluetooth.
    – niieani
    Apr 10, 2020 at 22:45
  • 2
    Can't get this to work. On Mojave 10.14.6.
    – ssssaaaa
    May 15, 2020 at 18:33
  • This actually works in Big Sur! Thank you! You solved the most annoying problem I had on Mac! Nov 15, 2020 at 11:09
  • 2
    Doesn't work for me on Big Sur after 5 restarts. I can confirm that the device's MAC address is returned with sudo defaults read /Library/Preferences/com.apple.Bluetooth.plist IgnoredDevices
    – ninja star
    Apr 6, 2021 at 4:19
3

This is a bit of a long shot, but at home go into System Preferences > Sound > Output and manually select the Default option (Usually Speakers).

This means that OS X will re-prioritise so that when the Belkin F8Z492-P Bluetooth Audio Adapter becomes available, you'd rather use the default option.

Then, when you want to use it, select it via the AirPlay menu (if possible) because that doesn't affect OS X's priorities. If it is not available via the AirPlay menu then you will just have to manually switch forward and back with the System Preferences app, unless you feel like diving into some AppleScripting.

2

I have Bluetooth headphones for which none of the previous solutions worked. By headphones were pretty cheap and I discovered that my Macbook Pro 2019's initial connection for auto-pairing was terrible (audio consistently skipped), but after disconnecting and reconnecting it was fine. I originally came to this post before Big Sur and back then adding my headphones’ MAC address to the list of IgnoredDevices (see answer from Kiyose) worked. But after Big Sur (currently on 11.4), neither DontPageAudioDevices nor adding to IgnoredDevices worked for me. This could be due to the shoddy implementation of Bluetooth on my cheap headphones, probably not uniquely due to Big Sur. In fact, connecting to my headphones totally messed up the Bluetooth module to the point where it couldn’t be turned on/off, and none of the traditional solutions (e.g. reset bluetooth module, BluetoothDebug, delete .plist files, etc.), other than reboot, could fix it. Obviously didn't want to have to reboot my Mac every time I wanted to connect headphones. So I came up with this solution for Bluetooth devices that are so problematic that you need to disconnect and unpair every time. This solution requires blueutil.

  1. Install blueutil:
homebrew install blueutil
  1. Use Automator (or any similar application) → Quick ActionsRun Shell Script with workflow set to receive no input and work in any application. Create two scripts that contain blueutil commands to pair/connect and unpair/disconnect to your bluetooth device. Note I found I needed to include full path for Automator's shell to find blueutil, perhaps because it is not being run interactively. You can confirm your scripts are working by monitoring System PreferencesBluetooth and using the Run button in Automator, before proceeding to the next step.
# pair/connect
/usr/local/bin/blueutil --pair <MAC_ADDRESS_OF_BT_DEVICE>
sleep 5
/usr/local/bin/blueutil --connect <MAC_ADDRESS_OF_BT_DEVICE>
# unpair/disconnect
/usr/local/bin/blueutil --disconnect <MAC_ADDRESS_OF_BT_DEVICE>
/usr/local/bin/blueutil --unpair <MAC_ADDRESS_OF_BT_DEVICE>
  1. Set up keyboard bindings to the Automator quick actions with System PreferencesKeyboardShortcutsServices. The new actions should be under General if you set to receive no input.

Now when you turn your bluetooth device on, simply use your keyboard shortcut to pair/connect. And when you're done, turn it off and run the disconnect/unpair action.

You must log in to answer this question.

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