Use Option as Meta Key in Mac OS X Terminal

Meta key in Mac OS X Terminal

By turning Option into the Meta key, you will be able to use familiar meta commands to jump around and navigate text in places like Emacs or bash shell without twisting your fingers around to poke at Esc. This won’t be applicable or useful to everyone, but it’s one of those must-use tricks for frequent terminal users or for anyone coming to the Mac OS X platform from a background in unix.

Here is how to use the Option key as a Meta key in the OS X Terminal app:

Open Terminal and pull down the primary Terminal menu to choose “Preferences”
Under the “Settings” section, find your default Terminal and click the “Keyboard” subsetting tab
Check the little box for “Use option as meta key” at the bottom of the window

Enable Meta key as Option in Mac OS X Terminal

Changes take effect immediately for all terminal windows using that. You can test it out by using commands like Option+B to jump forward a word, and Option+F to move back by a word, Option+M to return to the beginning of a line, and so on. The meta shortcuts are different from the standard text navigation shortcuts that are tied to the Control key and that work pretty much everywhere in Terminal and often across GUI based apps in OS X too.

If you didn’t know, the meta is enabled by default in OS X Terminal, but it’s assigned to the Escape key which isn’t particularly useful for those of us who are accustomed to the control, alt option, and command keys being used for keystroke shortcuts.

iTerm users can also make this change in the Profiles section of Preferences.