I'm toying around with DOSBox in debugger mode and it seems that in order to break into the debug mode while running I need to run Alt-Pause which on the Mac is Alt+F16 (see DOSBoxWiki: Special Keys). However, there is no F16 key on a MacBook Pro; if you hold Fn, you only get F1-F12.

Is there some way to either remap a function key or to have access to the higher function keys? Even using the Accessibility keyboard, it doesn't seem to have obvious access to these keys.

  • In the opening line of the link you posted - "These are the default keybindings. They can be changed using the keymapper."
    – Tetsujin
    Commented Feb 19, 2023 at 12:32
  • Even so, "how to use F13-19 on a laptop or short keyboard" is a great question. I remember trying to find a way to trigger the Clear key on a laptop, and was unable to do so.
    – benwiggy
    Commented Feb 19, 2023 at 12:39
  • @benwiggy - I'd imagine that would be one for Karabiner, but I've never tried it & all the keyboards here are extended anyway. I'd have thought for a one-off key in a single app, it would be simpler to remap it in there.
    – Tetsujin
    Commented Feb 19, 2023 at 12:49
  • 1
    @Tetsujin - yeah, I had missed the note about the remapper utility on that exact page. That said: 1) it isn't working as expected (so I guess I need to ask in the dosbox fora) and 2) it still is a useful thing to know how to do for cases where there isn't a builtin tool for it.
    – Simon Rose
    Commented Feb 19, 2023 at 18:03
  • Karabiner-Elements seems to be pretty much the de-facto standard for anything like that.
    – Tetsujin
    Commented Feb 19, 2023 at 18:07

1 Answer 1


To remap a key, you can use the hidutil command. In this example, I am remapping F16 to the ⌥ Option on the right side (probably not used much, if at all).

MacBook keyboard layout; Opt/Alt Highlighted1

hidutil property --set '{"UserKeyMapping": \
[{\"HIDKeyboardModifierMappingSrc":0x7000000E6, \

The backslashes (\) allow for a multi-line command to facilitate better readability. The command can be copied/pasted as-is or the backslashes and new-lines removed to make it a true one-liner.

When you're writing the command, keep this in mind:

  • Src = the key you want to press
  • Dst = what you want it to do

I have supplied a portion of the Hex values for the extended function keys as defined in Apple Technical Note TN240 that describes how to use hidutil.

Key Hex Code Key Hex Code
Keyboard F13 0x68 Keyboard F19 0x6E
Keyboard F14 0x69 Keyboard F20 0x6F
Keyboard F15 0x6A Keyboard F21 0x70
Keyboard F16 0x6B Keyboard F22 0x71
Keyboard F17 0x6C Keyboard F23 0x72
Keyboard F18 0x6D Keyboard F24 0x73

Improving with a script...

To make this complex command easier to work with, I have created a simple Bash script (below) that will allow you to specify the source and destination keys as variables.

I used a function, mdCMDStr, to "make the command string" so you can easily replicate additional commands with minimal effort. Simply, reassign the SOURCE and DEST variables and call the mkCMDStr and hidutil commands as many times as necessary.

#! /bin/bash

function mkCMDStr () {
# Creates the command string



SOURCE=0x7000000E6      #Keyboard Right Option/Alt              
DEST=0x70000006A        #Keyboard F16

hidutil property --set "${SETKEY_CMD}"


Download the Script

This will not persist through reboots. You can make this "permanent" by putting this script in Login Items or creating a LaunchAgent.

  • NSJSONSerialization Error Domain=NSCocoaErrorDomain Code=3840 "No string key for value in object around line 1, column 2." UserInfo={NSDebugDescription=No string key for value in object around line 1, column 2., NSJSONSerializationErrorIndex=2} Commented Jun 9, 2023 at 0:00
  • Cocoa? Where are you running this script?
    – Allan
    Commented Jun 9, 2023 at 0:07
  • This is awesome. Unfortunately I haven't been able to get it to map my Windows keyboard Print Screen (which I think gets interpreted as F13) to anything. For apple.stackexchange.com/q/461781/53510, I was thinking maybe since the F13 isn't getting captured by Flameshot, I could use hidutil to map Print Screen to something else, and then see if that other key could get monitored by Flameshot.
    – Ryan
    Commented Jul 5, 2023 at 18:00
  • The PrintScrn is pretty standard, but they (FlameShot) may be doing something different. Can you ask the devs what they are listening for?
    – Allan
    Commented Jul 5, 2023 at 18:02
  • I'll respond to your comment on the other question page. Thanks!
    – Ryan
    Commented Jul 5, 2023 at 21:53

You must log in to answer this question.

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