Apple Magic Keyboard 2 native function keys don't work I purchased an Apple Magic Keyboard 2 (the US layout model). I own a Macbook Pro 15" (Late 2012), updated to El Capitan (if relevant, this computer was running the El Capitan Beta prior to its release).

I turned on my keyboard for the first time and connected it using the lighting cable. A notification showed up telling me that the Magic Keyboard is ready to use.

When pressing the function keys, they don't perform the function they're labelled for (for example it's impossible to change the volume or brightness). All of the information I found on the internet so far didn't seem to reflect in my current situation.

These keys work correctly with the Macbook's built-in keyboard.

I am using the default US keyboard layout from OS X. When opening the keyboard viewer, the keyboard seems to be recognised as a non-Apple keyboard.



Another situation I've encountered is that when unplugging the keyboard after the initial set up, I get a window called "Keyboard Setup Assistant" which makes me press specific keys on the keyboard in order to recognise it, and ends up determining it is an ANSI keyboard. This seems like a strange behaviour.

EDIT: I also tried toggling the setting to use the F keys as standard function keys on and off, but to no avail.

EDIT 2: before using this new keybaord, I was using the old Apple Magic Keyboard, with the Italian layout, but OS X was configured to use a tweaked US layout (modified using Ukelele). For a while they were both connected to the system. I then unpaired the old keyboard.
It turns out that my problem was rare because the circumstances of it were rare too. I solved my problem successfully by upgrading from El Capitan Beta to the Stable release 10.11.4. I did this by downloading the installer from the App Store application (can be found in the Purchases tab), and running it on my PC. After selecting the drive on which the current OS X was installed, I waited around 30 minutes for the installation to complete. It was completed and I didn't lose any of my data.

Once I logged back in, I clicked on the Bluetooth icon while holding alt and shift, clicked on Debug and Remove all devices. After that, I reconnected my keyboard and it worked fine.