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?


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:

  1. Boot ubuntu. Open the Dash pressing (Command). Now type Bluetooth and press Return.
  2. Wait until the settings panel appears. Now press Tab until the + icon looks highlighted. Press Space.
  3. Find your Magic Mouse, and select it tabbing. Do tabbing again to the Next button.
  4. 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.

  1. Determine the Bluetooth adapter identifier (e.g. hci0)

    hcitool dev
  2. Scan for devices

    hcitool scan
  3. Locate the device you want to pair up with. Copy the hardware address on the clipboard.

  4. 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 (here 123456). Refer to the manual of your Bluetooth input device how to do this.

    It should output something like New device (/org/bluez/...

  5. Mark the device as trusted, system-wide:

    sudo bluez-test-device trusted aa:bb:cc:dd:ee:ff yes
  6. 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


Used this page as the main reference for the steps above:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.