Fixing keys in the OS X Terminal App

Ever have the problem in a Mac OS X terminal that when ssh’ed into a remote machine - delete (backspace on mac) hates you? It doesn’t work but instead send an unparsable character?

Here’s a quick fix.
From Frederic Wenzel’s blog:

Add the following line to your .profile:

stty erase ˆH

Since ˆH is a non–printable control character, the easiest way to do this is to execute the following command:

echo -e “stty erase ˆH” >> ~/.profile

Type the ˆH by pressing Control–V and Control–H.

He suggests some other steps - but this one was the only one I needed to get it working with ssh into my Ubuntu (6.10 was giving me trouble) and Gentoo Boxes. Awesome.

Updated:  Found more help in a  posting on this @ the macromates textmate blog. Excerpt below is from a comment by sjk.
For Meta key in terminal:

“Option-left/right-arrow will invoke backward/forward-word in bash, tcsh, and zsh by simply setting “Use option key as meta key” on the Keyboard page of Terminal Inspector, seen in the first screencapture of this article. That also makes the option key a meta key for other useful shell functions, which is much nicer (for Emacs junkies like me) than using the escape key or control-[. Some functions, like history-search-backward/forward, are particularly painful without the metafied option key.”