Last updated:

What is the Meta Key ?

The Meta Key (denoted as M or Meta) is a modifier key which mean it temporarily modify the normal action of another key when pressed together. Common modifier keys are shift, alt, or control. The meta key was a special modifier key marked with a solid diamond . Bash uses some meta keys combination for some advanced control that can quickly improve your velocity and productivity on the shell.

Unfortunately, keyboards without a meta key, and on macOS, this mean that meta key is replaced by the esc key which is not convenient at all and often more clunky than helpful. Though, you can have your macOS Terminal configured to use the option key as a meta key.

Why using Option as Meta Key?

With the meta key properly set for your Terminal, you can quickly improve your shell productivity by using some of the following sequences; assuming that you use the default bash keybindings which is based of emacs.

M+fMove forward one word (vs per character)
M+bMove backward one word (vs per character)
M+uUppercase a full word, starting at cursor
M+ulLowercase a full word, starting at cursor
M+dDelete word forward from cursorv
M+deleteDelete word backward from cursor
M+sSwap current word with previous word

How to Configure Terminal to Use Option as Meta Key?

You can programmtically configure your Terminal using defaults. If you are not familiar with this command line tool on macOS, check the post How To Change Preferences from the Command Line on macOS?.

The domain for the Terminal app is com.apple.Terminal. You will need to look for your default Window Setting with the key Default Window Settings. Then, based of this, look at the corresponding nested dictionary inside the dictionnary Window Settings and set the key useOptionAsMetaKey to 1.

Alternatively, instead of using defaults in the command line, you can simply go to the Terminal > Preferences... (or type +,). Then, Profiles > Keyboard and check the box Use Option as Meta key. Though, this wouldn’t be as fun.

GET UNIQUE TIPS AND THE LATEST NEWS BY SUBSCRIBING TO MY NEWSLETTER.
AND FOLLOW ME ON