A few times now, lucky me, have experienced that the bluetooth Apple keyboard is disconnected, and not working.

It has happened after putting my MBPr 15 into sleep, and when waking it up, the keyboard will not automatically reconnect, as it should.

Also, to top it off, the bluetooth settings in OS X seems to have frozen, as it does not respond anymore. You simply cannot turn off bluetooth, to try and reconnect the keyboard!

The first thing I tried, was to force quit the blued process, that manages the bluetooth. This did not work...

Two solutions

  1. You can restart your Macbook. This fixed the problem, but the downside is I had to save all my work, and resume after the reboot, which can be tedious (because trust me, this WILL happen again...).
  2. Instead of rebooting, you can force reload the bluetooth controller: Open a terminal and run these two commands:
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport

That should fix it!

Tip: You could create a Automator script for this, so it's easier to restart the bluetooth controller whenever your keyboard disconnects in the future. (Or, Apple could just issue a fix!....)