Fixing your Magic Keyboard when it won't connect anymore
If you got problems (re)connecting your Magic Keyboard with your Mac, there is a good chance a hard reset will help.
This works at least for the first generation of Magic Keyboard (with power button on the right side).
- Make sure the keyboard is working and has enough battery left (the green light on the top left should light up when you press the power button) and Bluetooth is enabled on your Mac (System Preferences -> Bluetooth).
- Switch off the keyboard: Hold down the power button until the green light turns off.
- Switch Keyboard on again but keep pushing the power button. After a few seconds the light will start blinking. IMPORTANT: Keep pushing the button until the keyboard is connected. If you release the button earlier you have to start with 2) again.
- Go to Bluetooth settings a look for a new Keyboard in the list. Click 'Connect' when it appears.
- If the connection succeeds macOS will ask you for a code to enter on the Keyboard. Do it.
- If this succeeds then you can release the power button