Mac OSX is not a great operating system when it comes to Bluetooth. Things get especially bad when you use Bluetooth for external speakers or wireless headphones. If you were playing music, the sound will break up and stays breaking up. In other words, the Bluetooth service on your Mac doesn't know how to recover from a bad state.
One thing you can do is to just go to the top right of the menu bar and then right-click the Bluetooth icon to turn Bluetooth off and then back on. But sometimes that icon is just not there.
If so, you can always go to the system preferences screen, find Bluetooth settings, and then turn Bluetooth off there.
But one problem you likely will have is that as soon as you turn Bluetooth off, you realize you just disconnected your mouse or your trackpad because most likely they are Bluetooth devices.
So is there a way to fully restart Bluetooth service (turn if off, and then turn it back on, and then reconnect all your Bluetooth devices) just from your terminal (using the command line)?
You are in luck. The answer is a definite YES! And this method works not only on Mojave but also on other versions of Mac OS as well!!
So here's what you have to do.
1. First you need to install a utility called blueutil. Run this command to install it:
brew install blueutil
2. Once the utility is installed, you just have to run this command:
blueutil -p 0 && sleep 1 && blueutil -p 1
If you don't want to remember all the parameters, just put this in a shell script file and call the script each time you want to restart Bluetooth service.
That's it, it's that simple!! You don't have to use the laptop touchpad to turn on Bluetooth again (because likely you have it closed and connect to multiple external monitors! You don't have to reboot your computer. You just run your script!! Credit goes to DjDCH on StackExchange.
If you find this kind of tip useful, you should definitely also read my other blog about restarting audio services on MacOS.
God created the keyboard so we can do everything just using the keyboard!
BTW: The easiest way to remember my blog address is http://blog.lannyland.com
0 comments:
Post a Comment