26

I'm used to having the Control button at the bottom left corner of the keyboard. It's a little annoying to be pressing Fn + Tab when I wanted a Control + Tab and the position of the Control button in the new Mac keyboard layout is just very uncomfortable for any finger to reach.

Does anybody know how you can make the Control and Fn buttons change function like how you can change the modifier keys in System Preferences?

3
  • 11
    Does anyone know why on earth has Apple decided to do this?
    – Mahdi
    Mar 30, 2017 at 8:06
  • Is it possible to map fn key only for combinations of alphanumeric keys? I would like fn key behave like control key only when pressed with combinations fn+a, fn+b..., fn+z, fn+1...fn+0. I would like still to get fn+F1, fn+F2... to work as factory default.
    – Marecky
    Dec 14, 2021 at 13:29
  • @Mahdi would like to know that as well. Worst part is their larger num pad keyboard has a big ctrl button and the fn key is somewhere else entirely. Consistency at its finest. Aug 13 at 17:38

10 Answers 10

21
  1. Download and install Karabiner

  2. Open Karabiner Elements and set the Target Device in the dropdown

  3. Map fn to left_control and left_control to fn as below

    Karabiner Elements Map fn to control

4
  • karabiner is great and does all things Feb 20, 2019 at 4:55
  • is apple a1243 or a1242 supported? Apr 28, 2020 at 1:17
  • 1
    I'm on Catalina 10.15.7. This works for most of my uses but now when I press 'fn' (that should now behave like 'ctrl') the Touch Bar still reacts to that and in my set-up the function 'buttons' are replaced with multimedia ones. So I cannot press, say, 'fn'+'f12' because as soon as I press 'fn' 'f12' disappears. Any way to stop that? Apr 8, 2021 at 15:32
  • @JohnnyBaloney: the same problem! May 10, 2021 at 13:39
18

Not sure which OS this started appearing in but in macOS 10.13, this can be customized in System Preferences > Keyboard > Modifier Keys:

System Preferences > Keyboard > Modifier Keys

13
  • 14
    I'm running 10.13.3 but do not see the fn Key in the modifier key window. Was it removed again?
    – Spork
    Mar 27, 2018 at 15:26
  • 7
    That's peculiar. I double checked, but see only 4 options. It also doesn't show up on google images for 'modifier keys' (the only exception being the image in this answer). Are you sure it isn't something you've installed?
    – Spork
    Apr 4, 2018 at 7:43
  • 19
    Sadly this only works to map fn to ctrl but it's impossible to map ctrl to fn.
    – andresp
    Jul 2, 2018 at 13:21
  • 2
    I'm in 10.14.2 and also only seeing 4 options (fn not being one of them).
    – rept
    Jan 7, 2019 at 23:49
  • 3
    Apple doing it again, can remap fn to ctrl but not the otherway around, truly geniuses ahead of its time. Nov 24, 2019 at 1:40
18

This is my white whale. I can't use Emacs without the control key being on the left hand side. Recently I got a new MacBook so I had a chance to do this without Karabiner.

This is what worked for me to rebind the function key to control (for the built-in keyboard only), on macOS 10.15.6.

hidutil property --matching '{ "ProductID": 0x027e }' --set '{
  "UserKeyMapping": [
    {
      "HIDKeyboardModifierMappingDst": 30064771300,
      "HIDKeyboardModifierMappingSrc": 1095216660483
    },
    {
      "HIDKeyboardModifierMappingDst": 30064771296,
      "HIDKeyboardModifierMappingSrc": 280379760050179
    }
  ]
}'

Verify it with hidutil property --matching '{ "ProductID": 0x027e }' --get "UserKeyMapping".

How I found these keycodes

I've both seen the option to change the Function (fn) Key and not seen the option to change the Function (fn) Key on the same computer, using the same version of macOS. Take it with a grain of salt, but I can consistently get the variant with the Function (fn) Key option to appear if I:

  1. Have an external keyboard attached, via a USB-Type C hub
  2. Open the Keyboard → Keyboard → Modifier Keys
  3. Lock the screen using the external keyboard
  4. Walk away for some time (wait until the computer sleeps)
  5. Wake the computer by pressing a key on the external keyboard and use Touch ID to log in
  6. Now the Modifier Keys preference has the Function (fn) Key option. While in this state, change the behaviour of the function key using the drop down list (I chose ^ Control)
  7. Copy ~/Library/Preferences/ByHost/.GlobalPreferences.${__UUID__}.plist (described here) somewhere else temporarily
  8. Convert the binary PList to XML: plutil -convert xml1 .GlobalPreferences.${__UUID__}.plist

Contents of that file are:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.keyboard.modifiermapping.1452-638-0</key>
    <array>
        <dict>
            <key>HIDKeyboardModifierMappingDst</key>
            <integer>30064771300</integer>
            <key>HIDKeyboardModifierMappingSrc</key>
            <integer>1095216660483</integer>
        </dict>
        <dict>
            <key>HIDKeyboardModifierMappingDst</key>
            <real>30064771296</real>
            <key>HIDKeyboardModifierMappingSrc</key>
            <integer>280379760050179</integer>
        </dict>
    </array>
</dict>
</plist>

This page shows up if you search for these HIDKeyboardModifierMappingSrc and says that 1095216660483 is for the left function key, 280379760050179 is for the right.

I thought I was going crazy so I took some screenshots for proof:

Modifier Keys preference pane without the Function (fn) Key option

Modifier Keys preference pane without the Function (fn) Key

Modifier Keys preference pane with the Function (fn) Key option

Modifier Keys preference pane with the Function (fn) Key

About ProductID

You can find the Product ID associated with your keyboard using the System Report button: Apple menu → System Report → Hardware → USB.

If you use the --matching parameter to hidutil using a specific Product ID, the changes will affect that piece of hardware only. For example, maybe you want to change the layout of the built-in keyboard, but not an external one.

enter image description here

6
  • Excellent post, thanks very much - this answer deserves to be much higher as it does exactly what is asked without the overhead of additional software. Sep 5, 2020 at 20:21
  • 1
    Nice aswer! But it didn't work, unfortunately. Fn started to work as Ctrl, but kept also working as Fn, and Ctrl didn't work as Fn. I'm using the MacBook Pro 16 here, so it seems there is some hardwired stuff in this hardware, probably related to the touch bar. Sep 8, 2020 at 3:57
  • I had the same problem as @BrunoJCM. This solution allowed me to map the Fn key to Ctrl, but it didn't map the Ctrl key to Fn. And when I press the Fn key, the function commands still pop up on the touch bar.
    – wheeler
    Nov 3, 2021 at 23:17
  • 1
    This is super nice solution ! Thank you! I value your process of finding out the right things. Now, if we need other codes, one can use hidutil-generator.netlify.app to find out the mapping (not my work). Nov 10, 2021 at 15:00
  • @wheeler it seems some keyboards generate different codes for Fn. I've found out form here: github.com/amarsyla/hidutil-key-remapping-generator/issues/3 Nov 10, 2021 at 15:01
6

you can use KeyRemap4MacBook

http://pqrs.org/macosx/keyremap4macbook/

you can find the included prepared settings list at this address:

http://pqrs.org/macosx/keyremap4macbook/list.html.en

as you can see there is the setting for Fn Key

2
  • Thank you! Worked like a charm. And it has many other useful settings, too!
    – radj
    Apr 16, 2013 at 9:21
  • As a heads up, this has been replaced by Karabiner-Elements Nov 30, 2021 at 0:19
3

I was happy, but then not as much. I just bought a Logitech K850 keyboard. Has a nice shape to help with wrist issues (for another time). Has keys from left as:

ctrl    fn    alt opt    cmd <butterfly>

Tried Karabiner but it didn't seem to work (tested by using ctrl-F in vi/vim). Then I found this document https://karabiner-elements.pqrs.org/docs/getting-started/features which lists a limitation.

Karabiner-Elements cannot modify the fn key on non Apple keyboards such as Logitech keyboards.

Not for Logitech. Ouch. Other suggestions? Back to best buy again? I'm really just looking for a mac layout keyboard with full size keys. I don't care about the num pad, etc. on right side. The K850 looked good except for this issue. Some gentle ergonomics help is good.

1
  • 1
    I am still using the K850 after more than a year. Though I cannot swap the ctrl and fn keys, I am very happy with this keyboard. I've grown accustomed to the layout and the feel is "oh so much" better than the macbook air 2018 laptop keyboard. FYI. Apr 28, 2020 at 16:31
3

I'm a new Mac user so I don't know much about how this was solved before. But this seems to be fixed in MacOs Monterey 12.5 (MacBook Pro 16'' 2021). No third application required :)

Keyboard preferences

2

You could also add this to private.xml:

<autogen>__KeyToKey__ KeyCode::FN, KeyCode::CONTROL_L</autogen>
<autogen>__KeyToKey__ KeyCode::CONTROL_L, KeyCode::FN</autogen>

See the source for the key code values and predefined settings.

1

In addition to trackpad gestures, Better Touch Tool allows you to remap individual keyboard combinations. I use it to remap fn ⇥ to ⌃ ⇥ and fn ⇧ ⇥ to ⌃ ⇧ ⇥.

1

Looks like the one way to make Karabiner work with Logitech keyboards is to uninstall Logi Options, but then:

  • the keyboard will behave like standard Apple keyboard - the mapping of function keys will differ from pictograms (I guess these can be remapped with Karabiner)
  • you will need to find another way to configure mouse buttons 3-5.
0

The hidutil-key-remapping-generator worked perfectly for me. You can access the tool online from hidutil key remapping generator for MacOS and copy the configuration to

~/Library/LaunchAgents/com.local.KeyRemapping.plist

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .