After many unsuccessful attempts to pair my Apple Wireless Keyboard via Bluetooth to my new Raspberry Pi 3 via the GUI interface, I was able to do this via command line using bluetoothctl.

The steps below show the successful steps in pairing the keyboard. Note I press and help the power button on the right side for five seconds prior to pairing (this may be the magic trick!).

pi@raspberrypi:~ $ sudo bluetoothctl

[NEW] Controller B8:27:EB:FF:FF:FF raspberrypi [default]

[NEW] Device C8:E0:EB:FF:FF:FF Apple Wireless Keyboard

[bluetooth]# agent on

Agent registered

[bluetooth]# default-agent

Default agent request successful

[bluetooth]# pairable on

Changing pairable on succeeded

[bluetooth]# pair C8:E0:EB:FF:FF:FF

Attempting to pair with C8:E0:EB:FF:FF:FF

Failed to pair: org.bluez.Error.ConnectionAttemptFailed

NOTE: Keyboard was off in not in pairing mode. This is where I press and held the power button

[bluetooth]# pair C8:E0:EB:FF:FF:FF

Attempting to pair with C8:E0:EB:FF:FF:FF

[CHG] Device C8:E0:EB:FF:FF:FF Connected: yes

[agent] PIN code: 599276

NOTE: I pressed the six digits on the Apple Wireless Keyboard followed by <return> and then it paired.

[CHG] Device C8:E0:EB:FF:FF:FF Paired: yes

Pairing successful

[CHG] Device C8:E0:EB:FF:FF:FF Connected: no

[bluetooth]# connect C8:E0:EB:FF:FF:FF

Attempting to connect to C8:E0:EB:FF:FF:FF

[CHG] Device C8:E0:EB:FF:FF:FF Connected: yes

Connection successful

[bluetooth]# quit

Agent unregistered

[DEL] Controller B8:27:EB:FF:FF:FF raspberrypi [default]

NOTE: Did not work until a reboot

pi@raspberrypi:~ $ sudo reboot

  1. Thank you!
    … I’ve been trying for days to get my keyboard to work and this finally did the trick.

    Thank you. Thank you!

  2. Thank you. Like Sam above I was similarly having a devil of a time getting an Apple Wireless Keyboard (Model A1314, from 2009) to pair with my Pi 3. It’s working perfectly now, and connects automatically again upon reboot.

  3. I wrestled with for a while before reading about turning the keyboard off and holding the power button to turn it on again. This worked a treat – thank you!

  4. Much thanks!! Very effective tutorial. One note for anyone trying to attempt in the future: if you have another keyboard attached and numlock in on, your apple keyboard will also be in numlock mode and the keys will appear to not be working correctly. Try turning off numlock on the first keyboard and shut it down/disconnect it. All should work well then. Thanks again.

  5. After following this and other instructions I was not able to make it work, then I remember that the keyboard was already paired with my iPad. As soon as I disconnected from it, it worked. Lesson learned.

    Thanks for publishing this info.

  6. Hi! I followed the guide, but once the keyboard was connected it didn’t work. when running “info XX:XX:XX:XX:XX” it was all connected, trusted and not blocked, but it is still not working. What do I do?

Comments are closed.