How can I tell exactly what keys are being pressed on the Mac?

Solution 1:

I don't know if the built-in keyboard viewer is sophisticated enough, but it should highlight pressed keys.

If you do not see those options, make sure it is checked off under your System Preferences > Keyboard

enter image description here

There are also apps like Keycastr that display bezel elements for pressed keys.

Solution 2:

The application Key Codes from Many Tricks, available for free from the App Store, displays the key code, unicode value, and modifier keys state for any key combination pressed on your computer. If you need more extensive information than that provided by the Keyboard Viewer, you might find it helpful.

Solution 3:

Karabiner Elements includes an Event Viewer that works really well. For example, Apple's Keyboard Viewer just ignores keypad keys; Karabiner-EventViewer shows them.