Select Page

How to pair Apple Wireless keyboard with Ubuntu PC?

When being paired through Ubuntu’s bluetooth GUI app, Apple Wireless keyboard will probably play dead, even if bluetooth manager says that its been successful connected. The other possible scenario is that it will prompt for pairing key but typing on a keyboard does nothing. Even if you manage to type in the pairing key, keyboard will probably remain dead after that.  If somehow you manage to connect and the keyboard works, it will disconnect when Capslock is pressed. 


Solution is simple… Don’t use bluetooth GUI utility! As it tends to be with many other GUI Linux apps, Bluetooth manager has some glitches and bugs, compared to old fashioned console commands. Although other BT devices might work fine when connected via GUI utility, Apple keyboards will probably not, so you’ll have to connect it through Linux console.

Follow the steps below by using another working keyboard:

1  Open up a new Ubuntu console window. Make sure that the Bluetooth module on your PC is turned on. At this moment, Apple keyboard MUST BE turned off (remove/return batteries cap to be sure).

2  Enter and execute sudo bluetoothctl command. If being asked for password, enter your sudo password.  You should now see [bluetooth]# at the beginning of line, which means that you successful entered Ubuntu Bluetooth Console Utility.

3  Execute the following commands, one by one:

power on

agent KeyboardOnly


pairable on

4  This is the moment to turn on the keyboard. Press power button and KEEP IT PRESSED all the time (until being told to stop). If you find difficult to do the following steps while keeping keyboard button pressed, ask someone else to do it for you. 

5  Enter and execute scan on command and wait for your keyboard being listed, along with its mac address which should look like this: 28:C6:3F:96:CE:12 (we’ll use this address as a placeholder during the rest of this tutorial)

6  Enter and execute following commands:

trust 28:C6:3F:96:CE:12

pair 28:C6:3F:96:CE:12

7  Message saying “Attempting to pair with 28:C6:3F:96:CE:12” should come up, and after couple of seconds it will give you a 6 number PIN code. RELEASE THE POWER button and enter the provided PIN using Apple keyboard. Do not pay attention if entered pin isn’t showing on the screen, just press ENTER after entering the PIN. After couple of seconds, you should get the message saying “Pairing successful”.

8  At this moment, your Apple keyboard should be working fine. Still it happens sometimes that it enters num-lock mode, which will make most of letter keys do nothing, while some of them will type numbers. To turn off this, hold down Fn key and press F6 twice. 

Your Wireless Apple Keyboard is working now and you can use it as any other PC keyboard. All settings will be saved after reboot or login/logout. Keys works as intended, except that you’ll use CMD key instead of WIN (meta) key. Still, there’s a limitation in terms of functionality compared to PC keyboards, and it is the lack of DEL key (delete forward). BUT… There’s a pretty useless EJECT key on the upper right corner, which you can easily remap to be used as DEL!  Tutorial below…

How to map Apple keyboard’s EJECT key to DELETE on Ubuntu PC?

1  Open up a new Ubuntu console window. 

2  Enter and execute sudo nano ~/.Xmodmap command. If being asked for password, enter your sudo password.  You should now see the content of .Xmodmap file, opened in Nano console editor. The file will probably be empty, so enter following lines (or append to the end, if there’s already something there):

keycode 169 = Delete

3  Press CTRL+X, then Y key for confirmation and finally ENTER to exit Nano.

NOTE: this tutorial was tested with Apple A1314 wireless keyboard and Kubuntu KDE desktop suite. It might or might not work for other keyboard/OS versions.