#!/bin/bash | |
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport | |
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport |
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
Thanks! =) |
This comment has been minimized.
This comment has been minimized.
Thanks.. it works!!! |
This comment has been minimized.
This comment has been minimized.
Thanks.. It works |
This comment has been minimized.
This comment has been minimized.
Thanks!!!! |
This comment has been minimized.
This comment has been minimized.
Does not work on El Capitain... First command crashed OS X and caused a reboot. |
This comment has been minimized.
This comment has been minimized.
My El Capitain didn't crash or reboot but still did not work.
and second command just turned off my bluetooth without the ability to turn it back on |
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
@zakiaziz: were you able to figure this out? I'm facing the same issue. |
This comment has been minimized.
This comment has been minimized.
Thanks! works fine on Yosemite |
This comment has been minimized.
This comment has been minimized.
Thanks! |
This comment has been minimized.
This comment has been minimized.
Not working in El Captain |
This comment has been minimized.
This comment has been minimized.
Thanks! |
This comment has been minimized.
This comment has been minimized.
Works great! |
This comment has been minimized.
This comment has been minimized.
works fine with 10.10.5 Yosemite |
This comment has been minimized.
This comment has been minimized.
Thanks! |
This comment has been minimized.
This comment has been minimized.
WOOT. Thank you. |
This comment has been minimized.
This comment has been minimized.
perfect! (10.10.5) |
This comment has been minimized.
This comment has been minimized.
worked perfectly (10.10.5) |
This comment has been minimized.
This comment has been minimized.
worked perfectly (10.10.5) |
This comment has been minimized.
This comment has been minimized.
As others have said, fails completely on 10.11.5 (El Capitan). |
This comment has been minimized.
This comment has been minimized.
I couldn't find a similar solution on 10.11 (El Capitan), so i decided to restart the whole Bluetooth Module. Should work in upcoming versions too. See this gist: https://gist.github.com/ralph-hm/a65840c4f5e439b90170d735a89a863f |
This comment has been minimized.
This comment has been minimized.
Beware: Failed for me too on El Capitan. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Do not work on El Capitan |
This comment has been minimized.
This comment has been minimized.
Worked for me on Yosemite (10.10.5). Thanks. |
This comment has been minimized.
This comment has been minimized.
Awesome..! Worked like a charm..! Thanks. |
This comment has been minimized.
This comment has been minimized.
Awesome! |
This comment has been minimized.
This comment has been minimized.
Thank you @nicolasembleton! |
This comment has been minimized.
This comment has been minimized.
Nice! |
This comment has been minimized.
This comment has been minimized.
It works!!! |
This comment has been minimized.
This comment has been minimized.
I've got a jagged line through the bluetooth icon in the menu bar, this doesn't work for me unfortunately.
|
This comment has been minimized.
This comment has been minimized.
Just what I needed. And it works, too. :-) Thanks! |
This comment has been minimized.
This comment has been minimized.
Flawless, just what i needed after bluetooth stopped working after a wake up from sleep |
This comment has been minimized.
This comment has been minimized.
Works for me, thanks! |
This comment has been minimized.
This comment has been minimized.
Worked for me! Yosemite 10.10.5. Thank you! |
This comment has been minimized.
This comment has been minimized.
Worked on MacOS Sierra 10.12.3. Thanks! |
This comment has been minimized.
This comment has been minimized.
Just saved me rebooting even after shift-option click to restart the BT module via debug menu didn't work. Thanks! |
This comment has been minimized.
This comment has been minimized.
Thanks! |
This comment has been minimized.
This comment has been minimized.
Thank you! |
This comment has been minimized.
This comment has been minimized.
Works on Sierra. |
This comment has been minimized.
This comment has been minimized.
Worked perfectly for me, thanks!! |
This comment has been minimized.
This comment has been minimized.
Doesn't work on El Captain! Restart needed. |
This comment has been minimized.
This comment has been minimized.
El Capitan 10.11.6: |
This comment has been minimized.
This comment has been minimized.
Thanks! Worked perfectly on Yosemite 10.10.5 |
This comment has been minimized.
This comment has been minimized.
Thank so much! |
This comment has been minimized.
This comment has been minimized.
Thanks much! Working for me on Sierra 10.12.6. Plus fixes my magic mouse connection issue instantly. :-) |
This comment has been minimized.
This comment has been minimized.
High Sierra:
|
This comment has been minimized.
This comment has been minimized.
Need solution for high sierra, after sleep Bluetooth dead until restart |
This comment has been minimized.
This comment has been minimized.
High sierra, pain in the ass. Anyone know this trick for this OS? |
This comment has been minimized.
This comment has been minimized.
you saved me a reboot, thanks a lot ! |
This comment has been minimized.
This comment has been minimized.
First command: $ sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport on Sierra, 10.12.6, MacBook Pro (13-inch, 2016, Two Thunderbolt 3 ports) I don't get why this seems to work only for ~50% of people as I see about the same amount of "thanks" as "doesn't work for me" messages here... anyone got an idea? |
This comment has been minimized.
This comment has been minimized.
Answering myself: kextfind -loaded | grep -i blue reveals that on my MacBook there are different dirvers loaded. Unloading them "works", but I have to explicitly unload IOBluetoothHostControllerUARTTransport and IOBluetoothHostControllerTransport like sudo kextunload -b com.apple.iokit.IOBluetoothHostControllerUARTTransport Bluetooth devices /keyboard, trouchpad)stop working as expected. |
This comment has been minimized.
This comment has been minimized.
Great! it works like a charm! |
This comment has been minimized.
This comment has been minimized.
@henning, I agree. This used to work without fail but seems to be intermittent now; and comes with the error you're seeing. Haven't done much testing but hopefully people will SEE THIS MESSAGE and post what OS version their running, along with the device (from the menu > about this mac) System Version: macOS 10.13.1 |
This comment has been minimized.
This comment has been minimized.
this is fantastic! Thanks so much |
This comment has been minimized.
This comment has been minimized.
I love you! |
This comment has been minimized.
This comment has been minimized.
I was having an issue and getting the "failed to unload" error as well. I had my trackpad plugged in via USB though. As soon as I unplugged the trackpad and ran the command again, I got the same error, but the bluetooth services reset themselves and my trackpad connected via Bluetooth again. |
This comment has been minimized.
This comment has been minimized.
@gbmeuk & @henning, Issue: Currently experiencing trouble with reconnecting my bluetooth headset and even the bluetooth process on my Mbp looks like it is not finding any other bluetooth devices (tried other devices like my smartphone etc). In most situations (putting my mbp to sleep) the issue of reconnecting my headset starts. Now normally a reboot of my OS is sufficient too re-align the processes in the correct order. But even that won't do the trick atm. I found this script and the alternate version that @0xfib shared. both version don't seem to be working, getting the same return values as reported by other users. Are you guys currently anyway closer to a solution? Returned values:
|
This comment has been minimized.
This comment has been minimized.
Getting error on macOS 10.13.3
|
This comment has been minimized.
This comment has been minimized.
macOS 10.13.4 works fine here to fix my bluetooth speaker connection
The more you do this, the more the number counts up
Let's get to 2,147,483,647? This might also help:
|
This comment has been minimized.
This comment has been minimized.
I found a even better solution. |
This comment has been minimized.
This comment has been minimized.
@uyjulian Thank you! It works! |
This comment has been minimized.
This comment has been minimized.
@uyjulian's solution worked for me on High Sierra 10.13.5. Thank you! |
This comment has been minimized.
This comment has been minimized.
codes above gives following response:
but this blueutil works for me on 10.13.5. |
This comment has been minimized.
This comment has been minimized.
High Sierra 10.13.5 (MBP 13 Early 2015) |
This comment has been minimized.
This comment has been minimized.
One solution which works for me on High Sierra is to kill the bluetooth daemon. It auto restarts which seems to sort it out. Here's a one liner (note it has to be done under sudo because the bluetoothd process isn't owned by $USER):
|
This comment has been minimized.
This comment has been minimized.
➜ ~ ./restart_bluetooth.sh |
This comment has been minimized.
This comment has been minimized.
Thanks! |
This comment has been minimized.
This comment has been minimized.
I'm on sierra and was getting the same 'Can't remove ...' error. You can just hold Shift+Option and click on the Bluetooth Icon Top Menu, It will reveal an option called Debug Menu item that has a Reset the Bluetooth Module option. If you need to do this in terminal for some reason, stackoverflow suggests.
|
This comment has been minimized.
This comment has been minimized.
A Comprehensive Solution
It's only sometimes that my bluetooth doesn't reconnect after sleep & wake (may be related to docking to my Thunderbolt Display) and I don't know how to immediately cause the problem, so I don't know what about that process is required. Obviously some of it is superfluous, but if I run that script my bluetooth dies and comes right back, so I know it's working well enough. If someone can pare it down to just what's necessary I'd love to hear the explanation (ping me @coolaj86). |
This comment has been minimized.
This comment has been minimized.
Awesome!!! Thanks!!! |
This comment has been minimized.
This comment has been minimized.
@will-dee thanks, your solution worked for my Hackintosh!! |
This comment has been minimized.
This comment has been minimized.
Same |
This comment has been minimized.
This comment has been minimized.
+1 |
This comment has been minimized.
This comment has been minimized.
Ahhhh still works like a charm Mac OS Sierra |
This comment has been minimized.
This comment has been minimized.
Thanks @coolaj86 |
This comment has been minimized.
This comment has been minimized.
Same +1 |
This comment has been minimized.
This comment has been minimized.
worked for me |
This comment has been minimized.
This comment has been minimized.
Same +1 |
This comment has been minimized.
This comment has been minimized.
Same +1 |
This comment has been minimized.
This comment has been minimized.
@uyjulian restart wifi & bluetooth works Thank you! |
This comment has been minimized.
This comment has been minimized.
@uyjulian solution worked on Sierra 10.12.6 |
This comment has been minimized.
This comment has been minimized.
anybody aware of a solution that works for Mojave 10.14.1? |
This comment has been minimized.
This comment has been minimized.
@stefandemi +1 |
This comment has been minimized.
This comment has been minimized.
I kept coming back to this and finally stumbled on this answer on stackoverflow: Using the method there I saw that This is the script I'm now using that seems to work for me:
There's also a fuller version that reconnects any previously connected devices using
|
This comment has been minimized.
This comment has been minimized.
None of these things worked for me - I was forced to reboot my mac in order to get bluetooth working properly again. I'm on a MacBook Pro (15-inch, 2018) running Mojave 10.14.4 |
This comment has been minimized.
This comment has been minimized.
None of these things worked for me - I was forced to reboot my mac in order to get bluetooth working properly again. I'm on a MacBook Pro (15-inch, 2018) running Mojave 10.14.4 |
This comment has been minimized.
This comment has been minimized.
None of these things worked for me - I was forced to reboot my mac in order to get bluetooth working properly again. I'm on a MacBook Pro (15-inch, 2018) running Mojave 10.14.4 |
This comment has been minimized.
This comment has been minimized.
@mgguinne Looks like Apple is breaking "vintage" Macs to sell more new ones. No sale. |
This comment has been minimized.
This comment has been minimized.
None of these things worked for me either, I'm on a 2015 Macbook pro 13'' with Retina Display and have had this problem since 2015. Currrently on 10.13.5... |
This comment has been minimized.
This comment has been minimized.
None of these work here. Latest MacOS |
This comment has been minimized.
This comment has been minimized.
This worked for me (tried it once so far): https://apple.stackexchange.com/questions/251842/how-to-restart-bluetooth-service-from-command-line |
This comment has been minimized.
This comment has been minimized.
If you have
Also available: https://gist.github.com/thiagoghisi/50c3ba835ea72cdb0318fb3306fd2c76 |
This comment has been minimized.
This comment has been minimized.
Thanks @thiagoghisi that worked really well for me :) Might be good to post to https://apple.stackexchange.com/questions/251842/how-to-restart-bluetooth-service-from-command-line as well as lot's on there are still having issues etc. Seems for some the kextunload/kextload works but for me never worked. |
This comment has been minimized.
This comment has been minimized.
Thanks. This is still useful for my MBP 2013 late. |
This comment has been minimized.
This comment has been minimized.
i got the "failed to unload error"... presumably because it was already unloaded and just needed to load via step 2... which #workedforme :D 10.13.6 High Sierra on late-2013 15" Retina MBP |
This comment has been minimized.
This comment has been minimized.
My result: |
This comment has been minimized.
This comment has been minimized.
First command failed for me because something was "already in use or retained" but I went ahead and ran the second command anyhow, then started Bluetooth - and everything worked! Thank you! |
This comment has been minimized.
This comment has been minimized.
worked fine. although I might add that I had a stuck (>20% cpu usage in activity monitor and no audio whatsoever playing or connected via bt) Then the op first command gave this: But the second command went without a hitch and now I have a working bt audio again without restarting. Good. & thanks! mojave latest version. |
This comment has been minimized.
This comment has been minimized.
Still works great on Mojave. Had a similar issue as some other people with unloading the daemon giving me an error, but then loading it again worked fine. Will reboot at some point here but this is really handy when your bluetooth bites the dust and you'd really prefer not to reboot just yet. |
This comment has been minimized.
This comment has been minimized.
I am having this issue nearly every day now, nothing I do works. I have to reboot. Making me think to fix = new mac
The below is the closest that might work, but I might have run some other commands first as Bluetooth now shows "Not Available". Will have to test next time it fails.
My Bluetooth devices.
system_profiler SPSoftwareDataType
|
This comment has been minimized.
This comment has been minimized.
My bluetooth connected device, for audio, keeps connecting/disconnecting. I don't have the answer to the problem but I can tell that the process |
This comment has been minimized.
This comment has been minimized.
A few notes about the topic that might be some help to somebody:
I hope there is some straightforward solution to this... |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I realized there was a macOS Catalina update available and decided to update https://support.apple.com/en-us/HT210642
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. |
This comment has been minimized.
This comment has been minimized.
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
}
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 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. |
This comment has been minimized.
This comment has been minimized.
I just started having choppy sound and tried this, which apparently worked, no problem for 5 minutes so far.
I'm using macOS 10.15.6 (19G2021) |
This comment has been minimized.
This comment has been minimized.
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 |
This comment has been minimized.
This comment has been minimized.
I found that killing the |
This comment has been minimized.
This comment has been minimized.
I filed a radar about this. Then added it to open radar: https://openradar.appspot.com/FB8801301 |
This comment has been minimized.
This comment has been minimized.
The wifi+bluetooth trick worked for me. Thanks. |
This comment has been minimized.
This comment has been minimized.
#!/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 |
This comment has been minimized.
This comment has been minimized.
Looks like you can't react to gists so |
This comment has been minimized.
This comment has been minimized.
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. |
This comment has been minimized.
This comment has been minimized.
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. |
This comment has been minimized.
Works like a charm, thanks!