Restart mac blutooth service

Sometimes my mac’s blutooth gets stuck, and I cannot attach any blutooth device nor turn it off and on. So, instead of restarting the laptop the following two commands fixes the problem.

To turn it off

sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport

To turn it on

sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport