Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to use the key "shift-tab" in emacs running purely under, but got an error saying there is no keybinding for "M-[ z" (where M is the meta key, set to be the option key under preferences). In other words, emacs thinks I am pressing "option-[ z" when I pressed "shift-tab" on the keyboard of my MacBook Pro running Mac OS X 10.6.6, what is the problem and how do I correct it? Thank you.

share|improve this question
up vote 4 down vote accepted is actually doing what it's supposed to: shift-TAB sends ESC [ z which Emacs reads as M-[ z. The problem is that the terminal description for xterm-color (the one usually used with and other terminal emulators) is missing the kcbt declaration, so Emacs doesn't know that that's what the key sends.

There are two ways to fix this:

  1. Edit the terminal description:

    $ infocmp >xterm-color.ti
    $ printf '\tkcbt=\E[Z,\n' >>xterm-color.ti
    $ sudo tic xterm-color.ti
  2. Tell Emacs about it directly:

    $ echo "(global-set-key "\M-[Z" 'something)" >>~/.emacs

The problem in both cases is that there doesn't seem to be a backwards-tab command to substitute for something. binds backtab to yank; what do you want it to do?

share|improve this answer
I am trying to use "shift-TAB" to cycle through all headings expanded vs closed in emacs org-mode. – hpy Mar 11 '11 at 22:36
Ok, I don't normally use that, but it has a <backtab> binding so you should use the first option (fixing the terminal description to define <backtab>). – geekosaur Mar 11 '11 at 22:41
If someone is only concerned with “fixing” their one account, then the sudo can be omitted to re-compile into ~/.terminfo/. This will also prevent it from being overwritten by a system update. – Chris Johnsen Mar 11 '11 at 22:50

As of Mac OS X Lion 10.7, Terminal is more compatible with modern xterm† and therefore the default $TERM value is now xterm-256color, which contains the kcbt entry, eliminating any need to edit the terminfo entry. xterm-color describes an older branch of xterm and is missing a number of things supported by modern xterm.

† Highlights include: Terminal now uses the BCE (Background Color Erase) color model, it supports 256 colors, and the latest xterm-compatible escape sequences for switching to/from the alternate screen buffer.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.