60

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.

2
  • If installing another app is an option, you might check out this gist: gist.github.com/ralph-hm/a65840c4f5e439b90170d735a89a863f
    – tim.rohrer
    Sep 7, 2016 at 16:44
  • 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 :) May 24, 2017 at 13:58

11 Answers 11

55

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
3
  • 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, 2018 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, 2018 at 16:02
  • 1
    Never heard of this util, saved my bacon. v10.14.5 for me and it works great. Installs with macports also, if you don't love brew either.
    – Andrew
    Jun 3, 2019 at 9:18
26

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
8
  • 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, 2016 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, 2016 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, 2016 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, 2016 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, 2016 at 14:55
20

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.

17
sudo pkill bluetoothd

NOTE: Works for me on macOS High Sierra

My Logitech MX Anywhere mouse does not work after sleeping sometimes. As I've read it's not because of mouse, it's a macOS Smart Bluetooth bug. But my Apple keyboard always works, never has 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 the lid but my keyboard also goes away, so cannot restart it again).

I started to use this command from the terminal, it stops the service but when the service stops it automatically restarts it self. And my mouse starts working within a second!

0
6

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
1
  • Thanks! This also works on macOS Monterey.
    – Happynoff
    Dec 16, 2021 at 9:26
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

1
  • 1
    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, 2018 at 7:55
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 

2

On BigSur you can simply do,

  1. Hold down the Shift and Option keys, then click on the Bluetooth icon in the menubar. If its not there then add by going to System Preferences > Bluetooth > Tick Show Bluetooth in menu bar.
  2. And then choose Reset the Bluetooth module from the menu.
2
  • Is this option removed in Monterey 12.x? Shift+Option+click BT icon does not show a Reset option for me.
    – luckman212
    Jan 23 at 20:43
  • Looks like it has been removed in Monterey
    – nixgadget
    Jan 25 at 8:04
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
1
  • 5
    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, 2017 at 18:54
0

all the variants mentioned here in this threads is not working properly, obviously series of error in the output.. I just want to put alias in bash_profile for turn off/on bluetooth service easily from terminal Does any help for Applescript variants for it, which I can easliy triggering through bash_profile alias typing just one short alias command like blueon/blueoff ?

MBP:~ applehead$ > system_profiler SPSoftwareDataType Software:

System Software Overview:

  System Version: macOS 10.14.6 (18G9323)
  Kernel Version: Darwin 18.7.0
  Boot Volume: Macintosh HD
  Boot Mode: Normal
  Computer Name:  MBP_appleHead
  User Name: applehead (applehead)
  Secure Virtual Memory: Enabled
  System Integrity Protection: Enabled
  Time since boot: 4 days 17:11
1
  • If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review
    – agarza
    Feb 5 at 14:03
0

My problem is losing Magic Mouse 2 from Macbook Air (Monterey 12.2). Then, I found the CPU usage of bluetoothd is high.

What I have tried is simply kill bluetoothd. And my Magic Mouse 2 reconnected as soon as I killed bluetoothd. It seems bluetoothd will restart automatically.

1
  • While this may be a solution, the OP specifically asked "from command line"
    – agarza
    Mar 18 at 4:38

You must log in to answer this question.

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