27

On Linux, if one wishes to restart the Bluetooth service, they simply launch a terminal and issue the following command:

sudo /etc/init.d/bluetooth restart

What is the equivalent on Mac OS X? I would like to restart my Bluetooth without having to restart the entire computer.

I am using Yosemite.

Update: Of the various command line options provided by Testing below the only one that seemed to work was the last, which is this:

sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport

Update 2: The above command no longer works and I wonder if it ever did. The first time I tried it it might have been something else that restarted my bluetooth services. The only thing that will work for me is a restart of the entire machine every morning.

  • Which version of OS X? It appears it may matter in this case. – tim.rohrer Sep 7 '16 at 16:26
  • If installing another app is an option, you might check out this gist: gist.github.com/ralph-hm/a65840c4f5e439b90170d735a89a863f – tim.rohrer Sep 7 '16 at 16:44
  • Excellent question. Still investing the point. I think there is a clean way on Mavericks and Yosemite. – dan Sep 9 '16 at 8:40
  • I removed the com.apple.Bluetooth.plist from /Library/Preferences/SystemConfiguration/ or /Library/Preferences/ and restarted > fixed. the terminal commands below did not work for me - but of course you can make a terminal command that removes this file and then restarts your mac :) – Thieme Hennis May 24 '17 at 13:58
25

On High Sierra, none of the command line options worked for me. I was able to plug in a wired USB mouse and use the Shift + Option with Debug/Rest solution.

I tried the blueutil solution on my High Sierra, and it worked like a charm. I regularly have Bluetooth on my 2015 MBPR with an Apple Magic Mouse hose up, and have to restart. Yeah, I could open the lid and use the track pad, but it's on the other side of the wall from my desk space.

You can install blueutil using Homebrew:

brew install blueutil

Or you can compile and install it by hand using:

cd ~/tmp/
git clone https://github.com/toy/blueutil.git
cd blueutil
make
make test 
cp blueutil ~/bin/

Now run:

blueutil -p 0 && sleep 1 && blueutil -p 1
  • I am running 10.13.3 and just successfully used the command line blueutil posted above. Thank you for that! – Chris Sia Jan 28 '18 at 2:02
  • 3
    Finally, something that works!!! – Mirko Mar 9 '18 at 11:58
  • 6
    The command didn't work for me. I had to run blueutil -p 0 && sleep 1 && blueutil -p 1 Also ~/bin resulted in location does not exist message. Required the full location which was /usr/local/bin. Worked perfectly then for me. Thanks. – Oliver Jun 27 '18 at 9:36
  • Running test seems successful, but always starts with ./test: line 3: read: 0.001: invalid timeout specification Then when I run blueutil off && sleep 1 && blueutil on I get -bash: blueutil: command not found – skybondsor Aug 27 '18 at 16:02
  • 2
    Just pointing out you can install this with homebrew: brew install blueutil – Alter Lagos Dec 13 '18 at 0:49
17

On El Capitan, it's kind of tricky because it doesn't allow you to unload system services. However, a brute-force method is:
sudo pkill blued
'blued' is the OS X bluetooth daemon, and it will automatically restart when terminated (at least when I tested it on my El Capitan machine). Other related daemons are: com.apple.bluetoothReporter, com.apple.IOBluetoothUSBDFU, and com.apple.bluetoothaudiod (you can look at the daemons running using sudo launchctl list)

You can also try:

sudo launchctl stop com.apple.blued
sudo launchctl start com.apple.blued

If you have an older OS X version, it's cleaner:

sudo launchctl unload /System/Library/LaunchDaemons/com.apple.blued.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.blued.plist

or

sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
  • I tried all three of the commands you suggested and none of them would kill and/or restart bluetooth. I say this because I was still able to use my bluetooth mouse and keyboard after issuing the 'kill' version of each of the commands. Any other ideas? I am on Yosemite at the moment. – zeeple Sep 7 '16 at 19:54
  • @zeeple: you are right. All the command provided by @Testing will cause an automatic restart of killed daemons because they are configured in this way by launchd (which command interface is launchctl). – dan Sep 9 '16 at 8:22
  • This morning none of these commands are working to get my bluetooth working again. The only thing that would work was a reboot of the OS. – zeeple Sep 12 '16 at 14:54
  • On El Capitan the sudo launchctl stop com.apple.blued command does indeed auto-restart the daemon without the start command. The older commands don't do anything on El Capitan so unfortunately I don't have much more insight (I upgraded my last Yosemite machine just a couple weeks ago). – Testing Sep 12 '16 at 18:07
  • Sadly, I work for a giant company with a backwards IT dept. They will not allow upgrading to anything beyond Yosemite. None of the commands above work for me at all. Restarting the entire machine every morning is the only thing that will work. – zeeple Oct 5 '16 at 14:55
7

One thing to mention is the daemon name blued (at least until macOS 10.11 El Capitan), has been changed to bluetoothd.

So based on the version of the macOS, you need to change the daemon name in the below command(s).

Another thing to note is that, unload then load the daemon's plist(instead of stop then start or sending HUP signal) may not work due to the SIP(System Integrity Protection) introduced in El Capitan. But it should work when you disabled the SIP or on macOS before El Capitan.

$ sudo launchctl unload /System/Library/LaunchDaemons/com.apple.blued.plist
$ sudo launchctl load /System/Library/LaunchDaemons/com.apple.blued.plist

Even in the SIP environment(after El Capitan) you can simply launchctl stop then launchctl start the daemon.

$ sudo launchctl stop com.apple.bluetoothd # or blued based on macOS version
$ sudo launchctl start com.apple.bluetoothd

In case you just want the status(on|off) of bluetooth to be changed, not wanting the daemon to actually restart, you can do the following,

# Let bluetooth be on 
$ sudo defaults write 
/Library/Preferences/com.apple.Bluetooth ControllerPowerState -int 1

# let bluetooth be off 
$ sudo defaults write 
/Library/Preferences/com.apple.Bluetooth ControllerPowerState -int 0

# Then reload the daemon
$ sudo killall -HUP bluetoothd # or blued based on macOS version
# On a macOS system which has proctools installed, you can replace `killall` to `pkill`

Blueutil is cool stuff, but it is using some private APIs of IOBluetooth.framework, so it may not work on the future version of macOS.

5

This 3rd party command line tool seems to work all the way up to High Sierra, abstracting away the differences between OSX versions: https://github.com/toy/blueutil

  • works for me on 10.13 blueutil off && blueutil s && blueutil on plus it can be installed via brew brew install blueutil – urandom Feb 8 '18 at 7:55
4
sudo pkill bluetoothd

Works for me on macOS High Sierra My Logitech mx anywhere does not work after sleep sometimes. As I read its not because of mouse, it's a macOS Smart Bluetooth bug. But my Apple keyboard always works, never got this issue. Sometimes I wake up my computer, the Apple keyboard is working but the Logitech mouse is not working. So without the mouse I cannot restart Bluetooth from the system (I could close but my keyboard also go away, so cannot restart again) I started to use this command from terminal, it stops the service but when the service stops it automatically restarts it self. And my mouse starts working within a second!

4

For my Macbook Pro 2017 with macOS High Sierra 10.13.6, I restart bluetooth using the following bash script:

#!/bin/bash

sudo launchctl stop com.apple.bluetoothd
sudo launchctl start com.apple.bluetoothd
2

Found this page on GitHub Gist with commands that worked for me (I am running Yosemite v. 10.10.5). You can simply type the following in the terminal to restart the bluetooth daemon without restarting:

sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport

sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport 

1

I am running Yosemite v10.10.5 and none of the other comments / gists worked for me at all. The only steps that I managed to figure out to take back to life the bluetooth driver was:

  1. Execute sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport in the terminal
  2. Restart computer without conserving the opened windows
  • 4
    For me, simply restarting the computer does the trick. What I am looking for is a command line way to do it without having to restart the entire machine. – zeeple Feb 20 '17 at 18:54

You must log in to answer this question.

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