Ghostty Remap Cmd to Control under macOS
Ghostty is ridiculously fast. But there’s one thing that bugged me: my thumbs.
Terminal shortcuts expect Control. Ctrl + a for line start, Ctrl + e for line end, Ctrl + k to kill the rest of the line. These are Emacs-style readline bindings, baked into every shell since the 80s.
Mac keyboards bury Control in the corner. Command sits right under your thumb where it belongs. I kept reaching for Command and getting nothing.
So I fixed it.
Karabiner? Nope.
First thing everyone suggests: Karabiner Elements. Global key remapping, very powerful.
Too powerful for this. A global Cmd→Ctrl swap hijacks Cmd + Tab , Cmd + C in other apps, and breaks app switching. Yes, Karabiner can do per-app rules, but the config is XML-heavy and fragile across updates.
Ghostty has built-in per-app keybinds. Problem solved at the right layer.
The fix
Drop this in your Ghostty config (~/.config/ghostty/config). Each line maps
Cmd
+
letter
to the corresponding ASCII control character:
keybind = cmd+a=text:\x01
keybind = cmd+b=text:\x02
keybind = cmd+c=text:\x03
keybind = cmd+d=text:\x04
keybind = cmd+e=text:\x05
keybind = cmd+f=text:\x06
keybind = cmd+g=text:\x07
keybind = cmd+h=text:\x08
keybind = cmd+i=text:\x09
keybind = cmd+j=text:\x0A
keybind = cmd+k=text:\x0B
keybind = cmd+l=text:\x0C
keybind = cmd+m=text:\x0D
keybind = cmd+n=text:\x0E
keybind = cmd+o=text:\x0F
keybind = cmd+p=text:\x10
keybind = cmd+q=text:\x11
keybind = cmd+r=text:\x12
keybind = cmd+s=text:\x13
keybind = cmd+u=text:\x15
keybind = cmd+w=text:\x17
keybind = cmd+x=text:\x18
keybind = cmd+y=text:\x19
keybind = cmd+z=text:\x1A
What the hex codes mean
The \x01–\x1A values are ASCII control characters. \x01 is Ctrl+A, \x02 is Ctrl+B, and so on — the hex value equals the letter’s position in the alphabet. So when you press
Cmd
+
a
, Ghostty sends the same byte your shell gets from
Ctrl
+
a
.
Keys I left out
- Cmd + t — new tab. You probably want that.
- Cmd + v — paste. Definitely want that.
Watch out for Cmd+C
Cmd
+
c
is mapped to \x03, which is SIGINT — the signal that kills a running process. This is the same as
Ctrl
+
c
, so it does the right thing in terminal. But it means you lose
Cmd
+
c
for copying text. Use
Cmd
+
Shift
+
c
or mouse selection instead if your workflow needs both.
Config originally from this Ghostty discussion.
Why bother?
If you only use macOS, maybe you don’t. Remap Caps Lock to Control in System Settings and call it a day.
But I jump between Mac, Linux, and Windows. Different keyboards, different layouts. My fingers expect Command in terminal on Mac, Control everywhere else. This config means my muscle memory works in Ghostty without fighting the rest of macOS.
Small fix, daily payoff.
Related: If you’re deep into keyboard ergonomics, I also wrote about Emacs, Apple keyboards, and RSI — the broader problem of making shortcuts work across platforms without destroying your wrists.