-
Star
(368)
You must be signed in to star a gist -
Fork
(59)
You must be signed in to fork a gist
-
-
Save nicolasembleton/afc19940da26716f8e90 to your computer and use it in GitHub Desktop.
#!/bin/bash | |
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport | |
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport |
macOS Catalina, NONE of these solutions are working:
- None of the solutions in this page, including but not limited to:
- OP
- https://gist.github.com/nicolasembleton/afc19940da26716f8e90#gistcomment-2262820
- https://gist.github.com/nicolasembleton/afc19940da26716f8e90#gistcomment-2559742
- https://gist.github.com/nicolasembleton/afc19940da26716f8e90#gistcomment-2668318
- https://gist.github.com/nicolasembleton/afc19940da26716f8e90#gistcomment-2682108
- https://gist.github.com/nicolasembleton/afc19940da26716f8e90#gistcomment-2882108
- https://gist.github.com/nicolasembleton/afc19940da26716f8e90#gistcomment-2404717
- https://gist.github.com/nicolasembleton/afc19940da26716f8e90#gistcomment-2964025
- https://gist.github.com/thiagoghisi/50c3ba835ea72cdb0318fb3306fd2c76
- the blueutils solutions
- all solutions here https://apple.stackexchange.com/questions/251842/how-to-restart-bluetooth-service-from-command-line
- closed Music and Spotify apps
- removed and re-paired my AirPods (the bluetooth device I'm trying to connect)
- disabled Siri and Voice Control
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 realized there was a macOS Catalina update available and decided to update https://support.apple.com/en-us/HT210642
It supposedly fixed:
Resolves an issue where certain USB mouse and trackpads may lose connection
Which I'd probably understand that it was actually issues with bluetooth (of which they forgot to mention sound devices).
I was forced to reboot, so the issue is gone for me but I'll definitely come back here if the bluetooth issue arrises again.
I took a stab at fixing this by unloading and re-loading all the kext that is related to audio and bluetooth. I have no understanding of kext, audio or bluetooth, though, so bear with my solution:
function xgh() {
shit_to_reboot=($(kextstat | grep -i "blue" | awk '{print $6}'))
echo "Found ${#shit_to_reboot[@]} shit to reboot:"
for shit in ${shit_to_reboot[@]}; do
echo "Rebooting $shit"
sudo kextunload -b "$shit"
sleep 5
sudo kextload -b "$shit"
echo "Rebooted $shit"
done
shit_to_reboot=($(kextstat | grep -i "audio" | awk '{print $6}'))
echo "Found ${#shit_to_reboot[@]} shit to reboot:"
for shit in ${shit_to_reboot[@]}; do
echo "Rebooting $shit"
sudo kextunload -b "$shit"
sleep 5
sudo kextload -b "$shit"
echo "Rebooted $shit"
done
}
kextunload
man: https://www.manpagez.com/man/8/kextunload/osx-10.4.php
However, the code above doesn't work because all those kext have dependencies that you can check by calling kextstat.
Next, I was going to recursively unload all the dependencies before attempting to unload a kext that has dependencies alive. That would be my next move.
Before doing that, I realized that there was a macOS update available https://support.apple.com/en-us/HT210642 that supposedly fixed an issue where certain USB mouse and trackpads may lose connection
. I'm gonna assume that that issue was affecting all bluetooth connections, so speakers could be involved.
I decided to update my mac to the latest version, which required a reboot, so the problem stopped occurring (as stated in my last post above).
I'll definitely come back to this thread if the problem happens again though. So far, several hours have lapsed without facing the issue.
Hope this helps someone.
I just started having choppy sound and tried this, which apparently worked, no problem for 5 minutes so far.
- Closed Music (iTunes)
- Turned off headset (Bose QC35 ii)
- Turned headset on, macOS wasn't detecting it (iOS did connect automatically)
- Turned off bluetooth
- Turned on bluetooth
- macOS wasn't automatically connecting headset
- Manually connected headset
- Opened Music
- Now listening to music for 5 minutes.
I'm using macOS 10.15.6 (19G2021)
I'll definitely come back to this thread if the problem happens again though. So far, several hours have lapsed without facing the issue.
I have faced the problem again several times. However, after the update, running:
sudo kill `pgrep coreaudiod`
seems to be actually killing the audio system (which wasn't happening before), which actually resolves the problem. So, the problem still arrises, however it is fixable without rebooting π¬ (so far, anyway).
I found that killing the bluetoothaudiod
service helps if audio does not seem to be working. This case must be similar to the coreaudiod
one. Thx.
I filed a radar about this. Then added it to open radar: https://openradar.appspot.com/FB8801301
The wifi+bluetooth trick worked for me. Thanks.
#!/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
```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 startI use this script and fixed my problem :D
Looks like you can't react to gists so π
macOS Catalina, NONE of these solutions are working:
None of the solutions in this page, including but not limited to:
- OP
- https://gist.github.com/nicolasembleton/afc19940da26716f8e90#gistcomment-2262820
- https://gist.github.com/nicolasembleton/afc19940da26716f8e90#gistcomment-2559742
- https://gist.github.com/nicolasembleton/afc19940da26716f8e90#gistcomment-2668318
- https://gist.github.com/nicolasembleton/afc19940da26716f8e90#gistcomment-2682108
- https://gist.github.com/nicolasembleton/afc19940da26716f8e90#gistcomment-2882108
- https://gist.github.com/nicolasembleton/afc19940da26716f8e90#gistcomment-2404717
- https://gist.github.com/nicolasembleton/afc19940da26716f8e90#gistcomment-2964025
https://gist.github.com/thiagoghisi/50c3ba835ea72cdb0318fb3306fd2c76
the blueutils solutions
all solutions here https://apple.stackexchange.com/questions/251842/how-to-restart-bluetooth-service-from-command-line
closed Music and Spotify apps
removed and re-paired my AirPods (the bluetooth device I'm trying to connect)
disabled Siri and Voice Control
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.
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.
just $ sudo pkill bluetoothd
then daemon bluetooth service will restart self (tested success on macOS 10.14+).
#!/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 startI 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! π
@paulbargaoanu you are welcome. I am glad it works :D
#!/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 startI use this script and fixed my problem :D
Works for BigSur. Thanks!
#!/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.
@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.
A few notes about the topic that might be some help to somebody:
pgrep bluetoothaudiod
doesn't return anything.I hope there is some straightforward solution to this... π