Skip to content

Instantly share code, notes, and snippets.

@nicolasembleton
Last active October 21, 2022 20:10
Show Gist options
  • Save nicolasembleton/afc19940da26716f8e90 to your computer and use it in GitHub Desktop.
Save nicolasembleton/afc19940da26716f8e90 to your computer and use it in GitHub Desktop.
Restart Bluetooth Daemon on Mac OS X without restarting
#!/bin/bash
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
@rogerluan
Copy link

rogerluan commented Oct 15, 2020

I filed a radar about this. Then added it to open radar: https://openradar.appspot.com/FB8801301

@igorrs
Copy link

igorrs commented Nov 4, 2020

The wifi+bluetooth trick worked for me. Thanks.

@agate
Copy link

agate commented Mar 19, 2021

#!/usr/bin/env bash

pgrep audio | xargs sudo kill
pgrep bluetooth | xargs sudo kill

sudo launchctl list | grep -i blue | awk '{ print $3 }' | xargs sudo launchctl stop
sudo launchctl list | grep -i blue | awk '{ print $3 }' | xargs sudo launchctl start
sudo launchctl list | grep -i audio | awk '{ print $3 }' | xargs sudo launchctl stop
sudo launchctl list | grep -i audio | awk '{ print $3 }' | xargs sudo launchctl start

I use this script and fixed my problem :D

@dmitrym0
Copy link

```shell
#!/usr/bin/env bash

pgrep audio | xargs sudo kill
pgrep bluetooth | xargs sudo kill

sudo launchctl list | grep -i blue | awk '{ print $3 }' | xargs sudo launchctl stop
sudo launchctl list | grep -i blue | awk '{ print $3 }' | xargs sudo launchctl start
sudo launchctl list | grep -i audio | awk '{ print $3 }' | xargs sudo launchctl stop
sudo launchctl list | grep -i audio | awk '{ print $3 }' | xargs sudo launchctl start

I use this script and fixed my problem :D

Looks like you can't react to gists so 👍

@xab3r
Copy link

xab3r commented Apr 14, 2021

macOS Catalina, NONE of these solutions are working:

And the symptoms are: when I try to connect to my AirPods, it connects, but the audio doesn't connect. After exactly 10 seconds, the AirPods disconnect (bluetooth still on, audio still goes through the internal speakers).

I second @cabellerofelipe: rebooting the mac does the trick, but it's a pain in the ass 😞

Does anyone have any other ideas? 😬

I had a similar issue with BT on my MacBook Pro 13" 2017 for some period of time. Seems it was a software problem because it's gone over time, I assume with some of the MacOS updates.
My solution was to plug an external BT dongle to the laptop, make sure OS recognized it and then unplug it. Sometimes I tried to connect/disconnect the headset via that external adapter. This trick always worked. That sounds crazy but I had to keep the "rescue" BT adapter in my backpack.

@rogerluan
Copy link

Latest update from me, who initially wrote this: https://gist.github.com/nicolasembleton/afc19940da26716f8e90#gistcomment-3422499

I've been running macOS 11.2 since Feb 8th and since then the bluetooth problems decreased from like "a few times a day" to "maybe once a week" or even less often than that.

@opsforce
Copy link

opsforce commented Jul 9, 2021

just $ sudo pkill bluetoothd
then daemon bluetooth service will restart self (tested success on macOS 10.14+).

@paulbargaoanu
Copy link

#!/usr/bin/env bash

pgrep audio | xargs sudo kill
pgrep bluetooth | xargs sudo kill

sudo launchctl list | grep -i blue | awk '{ print $3 }' | xargs sudo launchctl stop
sudo launchctl list | grep -i blue | awk '{ print $3 }' | xargs sudo launchctl start
sudo launchctl list | grep -i audio | awk '{ print $3 }' | xargs sudo launchctl stop
sudo launchctl list | grep -i audio | awk '{ print $3 }' | xargs sudo launchctl start

I use this script and fixed my problem :D

Seems to be working on a Mac Mini 2018 running Mac OS Big Sur 11.5.2 (20G95)

Thank you very much, kind stranger! 🙏

@agate
Copy link

agate commented Aug 27, 2021

@paulbargaoanu you are welcome. I am glad it works :D

@dobando-dev
Copy link

#!/usr/bin/env bash

pgrep audio | xargs sudo kill
pgrep bluetooth | xargs sudo kill

sudo launchctl list | grep -i blue | awk '{ print $3 }' | xargs sudo launchctl stop
sudo launchctl list | grep -i blue | awk '{ print $3 }' | xargs sudo launchctl start
sudo launchctl list | grep -i audio | awk '{ print $3 }' | xargs sudo launchctl stop
sudo launchctl list | grep -i audio | awk '{ print $3 }' | xargs sudo launchctl start

I use this script and fixed my problem :D

Works for BigSur. Thanks!

@AnaatGitHub
Copy link

#!/usr/bin/env bash

pgrep audio | xargs sudo kill
pgrep bluetooth | xargs sudo kill

sudo launchctl list | grep -i blue | awk '{ print $3 }' | xargs sudo launchctl stop
sudo launchctl list | grep -i blue | awk '{ print $3 }' | xargs sudo launchctl start
sudo launchctl list | grep -i audio | awk '{ print $3 }' | xargs sudo launchctl stop
sudo launchctl list | grep -i audio | awk '{ print $3 }' | xargs sudo launchctl start

After months of searching and trying stuff, this seems to work on Catalina OS (10.15.7) on a MacBook Pro 8,1. As soon as I ran the script, the bluetooth started working again. No rebooting or resetting the SMC module needed so far. The bluetooth conection will still drop out after a while, but the script is definitely more convenient than the rebooting every 30 minutes like previously.

Thanks a bunch, @agate ! Do you have any idea as to why this works and if there is a more permanent fix?

Cheers.

@agate
Copy link

agate commented Feb 8, 2022

@AnaatGitHub so I just violently killed all the Bluetooth and Audio related processes. I guess MacOS is smart enough to restart all those background processes if you are trying to use them later. You know "reboot fixes almost 99 percent problem" lol.

BTW, I am not sure if there is any other way / app for doing such thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment