I have a Mac Mini with an Apple Magic Mouse bluetooth mouse. In order to set up a bluetooth mouse, though, it looks like you have to use a mouse. Doesn't that completely defeat the purpose? Is there a way I can set up my bluetooth mouse using the commandline?
2 Answers
I'm not really sure if you can do it in a terminal, but with my iMac I used tabbing instead.
Tabbing is just that, pressing Tab all the time until you highlight the button that you want to "click", of course, using Space.
I would recommend you to get an USB Mouse, anyway here you have some steps:
- Boot ubuntu. Open the Dash pressing ⌘ (Command). Now type Bluetooth and press Return.
- Wait until the settings panel appears. Now press Tab until the + icon looks highlighted. Press Space.
- Find your Magic Mouse, and select it tabbing. Do tabbing again to the Next button.
- Now wait until the mouse is correctly linked.
Happy ubunting on your Mac Mini! :)
No need for 'tabbing' around
Here's how to do pair input devices using the command line. I assume you put your device in discovery mode first, of course.
Determine the Bluetooth adapter identifier (e.g.
hci0
)hcitool dev
Scan for devices
hcitool scan
Locate the device you want to pair up with. Copy the hardware address on the clipboard.
Try to connect (replace
hci0
with your actual Bluetooth adapter identifier as well as the Bluetooth device address to pair with):sudo bluez-simple-agent hci0 aa:bb:cc:dd:ee:ff
- For keyboards only: In case the above step returns something like
DisplayPasskey (/org/bluez/537/hci0/..., 123456)
, then the last part is the PIN number to enter (here123456
). Refer to the manual of your Bluetooth input device how to do this.
It should output something like
New device (/org/bluez/...
- For keyboards only: In case the above step returns something like
Mark the device as trusted, system-wide:
sudo bluez-test-device trusted aa:bb:cc:dd:ee:ff yes
If it doesn't work yet at this point already, try this:
sudo bluez-test-input connect aa:bb:cc:dd:ee:ff
Further idea: Create a wrapper script to make it a single command for your machine.
Reverting actions
Also useful if you get errors due to other applications having fiddled with Bluetooth.
sudo bluez-simple-agent hci0 aa:bb:cc:dd:ee:ff repair
References
Used this page as the main reference for the steps above: