Magic Keyboard doesn't pair
Hi.
I have 2 Macbook Pro and I'm trying to use blueutil to quickly pair an Apple Magic Keyboard on one or other. I'm running this shell script:
if [ $connected -eq '1' ]
then
echo "already connected"
else
echo "unpairing with BT device $id, $name"
blueutil --unpair "$id"
echo "unpaired, waiting a few seconds for device to go to pairable state"
sleep 3
echo "pairing with BT device $id, $name"
blueutil --pair "$id"
echo "paired"
blueutil --connect "$id"
echo "connected"
fi
The keyboard gets unpaired successfully, but then blueutil gets stuck on the --pair command. I need to turn off and on the keyboard again and add it through the Bluetooth settings.
Is this a common issue or is there anything I can adjust on my script?
- blueutil 2.10.0
- macOS 12.7.6 (Monterrey)
- Macbook Pro 15-inch, Mid 2015
- Apple Magic Keyboard with numpad
Thank you.
The commands are correct, but I'm wondering about the script, as it unpairs then pairs and connects the same device. Anyway please check if bluetooth is allowed for the terminal application that you are using. Also have you tried with any other bluetooth device and does it not work on both macbooks?