Linux Macbook Function Key Mode – fnmode

So, I couldn’t figure out how to get my Macbook function keys to default to function keys under Linux, rather than media keys such as brightness, volume control, etc.  I searched all over the net for information on this feature, and could only find stuff about pb_fnmode (which doesn’t appear in the latest kernels).  So, I finally resorted to grepping “fnmode” out of the sources, and found the location that sets this.  Then, I noticed that the kernel module that handles Mac key mappings had a parameter that could be changed, called “fnmode”.  Well, that gave me a clue that it may be in /sys/ somehwere.  So, I searched, and sure enough, it was there.  The following command will set the function keys to be the default action, rather than media keys.

echo 2 > /sys/module/hid_apple/parameters/fnmode

The valid values are (0 = disabled, [1] = fkeyslast, 2 = fkeysfirst)

This effectively reverses the function key/media key mappings.

8 thoughts on “Linux Macbook Function Key Mode – fnmode

    1. rvl

      Thanks, very helpful! To make it permanent, create a file called /etc/modprobe.d/apple.conf and put the line “options hid_apple fnmode=2” into it.

      Reply
  1. Aaron

    Finally! A solution for the accursed Fn+F# key issue. Mac users touching an iSeries have lots of problems with this…

    Still works in late 2015 on Ubuntu 15.10 on a MBP.

    Reply
  2. Troy

    Every time I do a reinstall on a Mac I end up searching for how to fix this, then I end up on this post. Thanks for saving my sanity time and again.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *