How to remap Mac keyboard with Xmodmap

I was trying to remap my Mac's keyboard with Xmodmap, but it was only somewhat successful. The remapping works when I look for the keycodes with the event tester, but when I actually type the keyboard is not remapped. The code I'm using is
nano .Xmodmap

keycode 10 = e
keycode 11 = t
keycode 12 = y
keycode 49 = h
keycode 39 = o
keycode 48 = i
keycode 46 = n
keycode 22 = d
keycode 23 = f
keycode 25 = k
keycode 24 = j
keycode 42 = r
keycode 39 = l
keycode 53 = p
keycode 43 = semicolon
keycode 45 = o
keycode 65 = BackSpace
clear lock

xmodmap .Xmodmap

A similar program (with different keycodes) works on my raspberry pi, so I'm wondering if there's any additional steps needed to be taken on a Mac in order to have the xmodmap keyboard be the one to actually send the keypresses.


Solution 1:

Xmodmap only works for X11 applications, the ones you've listed for sure are not X11 applications. Most likely you don't use any X11 at all.

To remap keys on macOS see the answer on Karabiner quit working in Sierra. How do I map my menu/application key to be Command? instead.

Another app commonly used to remap MacOS keys is Ukelele.