Fixing backspace in screen in Terminal on OS X

Some title, eh? The problem is this: When using screen on a remote host in Terminal on OS X, backspace doesn’t work. Highly irritating. Here’s the solution. In the terminal, run:

defaults write com.apple.Terminal TermCapString xterm

And you’re all set.

2006/05/15
Previously On Atomized:

Discussion

[...] The biggest problem turned out to be backspace. It didn’t work at all when using screen on a remote host. Luckily Google pointed me here. The solution was to type a somewhat cryptic command in Terminal – certainly something I didn’t expect OS X to require me to do! [...]

Tweaking Terminal - Macified
2006/05/30

I spent way too long looking for a fix for this… I had this same problem on osx but while using “aterm” instead of terminal. This page helped me figure it all out though. If you’re using a terminal other than “Terminal.app,” this is what you do:

export TERM=xterm

You can put that in your .bashrc, .zshrc, or whatever you use.

ted
2006/06/26

Thanx for the tip! You we’re my saviour !

domi235
2007/02/01

Works great! Thank you!

Albert Peschar
2007/02/24

I love you. Really. Can’t believe how long I’ve been looking for a solution for this problem + how simple the actual solution is… Thanks.

I will now go and delete heaps of characters.

arne
2007/04/02

Cool, export TERM=xterm works for me, OSX, using terminal.app sshing to a remote server and running screen there.

Matt
2007/07/02

This is just wonderful! I tried tons of different terminal applications and none of them worked out of the box.

Mikko Ohtamaa
2007/10/12

Damned, it works :)
i think to change many thinks…but not this TERM environnment variable !

Gui
2008/08/08

Erm, since the modificaiton, see that Backspace produce ^? on such ssh remote shell. After a while, Terminal/Preferences, changing type of terminal to “rxvt” rocks for me perfectly (vi, ssh, screen, …)

Gui
2008/08/09

There is also a checkbox in the advanced terminal.app preferences that will fix this issue. Just enable the checkbox, “Delete sends Ctrl+h”.

This way you can leave you terminal declared as xterm-color.

tata
-flip

designdream
2008/11/10

@desgindream Yeah, this was added in Leopard. In Tiger, changing $TERM was the only way to make it work.

Ian
2008/11/11

Nice!

I used the GUI myself: I just changed the terminal to “xterm” in the preferences for each of the Settings group.

Works well now

Troy
2008/12/10

[...] February 22, 2009 Every time I use terminal in combination with an ssh connection to a remote host and the execute screen I’m not able to use the backspace key. Found a soultion in the comment section of atomized [...]

backspace problem with screen in remote debian with os x « 0xcb0’s Blog
2009/02/22

export TERM=xterm

that worked a treat :) Now I can stop getting annoyed when using irssi :)

Hamlesh Motah
2009/03/03

As others have said, export TERM=xterm fixes things. Put it in ~/.bash_profile to add it permanently.

Ben
2009/03/31

I had this exact problem on Mac OSX and the above did _not_ fix it for me. However I found a really simple fix that no-one has mentioned anywhere yet.

Open terminal. Go to the terminal menu in finder -> preferences.

Click on the “Advanced” button on the right then change the pull down box next to “Declare Terminal as” to “ANSI” and close settings. You will need to fully exit and reload terminal for this to take effect.

Viola! Fixed!

Chris
2009/06/29

Exactly what I was looking for! thanks! export TERM=xterm worked for me though, on snow leopard.

verma
2009/11/06

thank you so much!

max
2009/12/19

Participate