How to tap/hook keyboard events in OSX and record which keyboard fires each event
问题 I've now discovered how to hook/tap keyboard events on OS X at a low level: How to tap (hook) F7 through F12 and Power/Eject on a MacBook keyboard Printing out the code from that answer: // compile and run from the commandline with: // clang -framework coreFoundation -framework IOKit ./HID.c -o hid // sudo ./hid // This code works with the IOHID library to get notified of keys. // Still haven't figured out how to truly intercept with // substitution. #include <IOKit/hid/IOHIDValue.h> #include