mac2024년 12월 8일1 min read

How to Set Up Alt Key Mapping in iTerm2 on Mac

Configure the Alt key in iTerm2 so that Option + arrow keys jump word by word, just like on Linux terminals.

FFrank Advenoh
#m1#맥북#iTerm2

1. Overview

When using a terminal in a Linux environment, the Alt key combined with the arrow keys (←, →) lets you move word by word — a feature that's enabled by default and very convenient. However, on the Mac's iTerm2, this feature isn't set up by default; instead, pressing those keys just displays values like ^[D or ^[C.

> helm upgrade --install asynqmon . -f values-dev.yaml -n dev [D[D[C[C

In this post, I'll show you how to map the Alt key in iTerm2 so you can use this feature on a Mac as well.

2. How to Set Up Alt Key Mapping in iTerm2

In Settings > Profiles > Keys > Key Mappings, add new mappings as shown below.

  • ⌥← :
    • Action: select Send Escape Sequence
    • Esc +: enter the value b
  • ⌥→ :
    • Action: select Send Escape Sequence
    • Esc +: enter the value f

Adding a new key

In the end, you just need to add the two key mappings shown below.

Key Mapping

3. References

관련 글