nano error: Error opening terminal: xterm-256color
Solution 1
On Red Hat this worked for me:
export TERM=xterm
further info here: http://www.cloudfarm.it/fix-error-opening-terminal-xterm-256color-unknown-terminal-type/
Solution 2
After upgrading to OSX Lion, I started getting this error on certain (Debian/Ubuntu) servers. The fix is simply to install the “ncurses-term” package which provides the file /usr/share/terminfo/x/xterm-256color.
This worked for me on a Ubuntu server, via Erik Osterman.
Solution 3
I can confirm this is a terminfo issue. This is what worked for me. SSH in to the remote machine and run
sudo apt-get install ncurses-term
Boom. Problem solved.
Solution 4
edit your
.bash_profilefilevim .bash_profilecommnet
#export TERM=xterm-256coloradd this
export TERMINFO=/usr/share/terminfoexport TERM=xterm-basicto your
.bash_profilefinally
run:
source .bash_profile
Solution 5
I, too, have this problem on an older Mac that I upgraded to Lion.
Before reading the terminfo tip, I was able to get vi and less working by doing "export TERM=xterm".
After reading the tip, I grabbed /usr/share/terminfo from a newer Mac that has fresh install of Lion and does not exhibit this problem.
Now, even though echo $TERM still yields xterm-256color, vi and less now work fine.
Luke
Updated on September 21, 2021Comments
-
Luke over 1 yearAfter the installation of OSX Lion, I tried to:
nano /etc/apt/sources.listBut I get this error:
Error opening terminal: xterm-256colorIf I try to switch terminal.app preferences to open terminal windows in "xterm color" instead of
xterm-256coloreverything works fine.What's happening?
-
Mike Lawrence almost 12 yearsI encountered the same error and tried your suggested steps. I encountered a number of permission denied errors while unpacking with unpkg. The BSD folder appeared on my desktop, and I ran "sudo mv ~/Desktop/BSD/usr/share/terminfo /usr/share/terminfo" then restarted terminal, but I still get the same "Error opening terminal: xterm-256color" error. -
Luke almost 12 yearsmaybe you can try this sendspace.com/file/hc2dus it's my terminfo folder. after replacing it, don't forget to chmod 555 /usr/share/terminfo -
DOOManiac over 9 yearsThanks for an answer that did NOT involve changing the server! -
Nicolas Barbulesco over 8 yearsThis does not work for me. I connect from a Mac in Mavericks to a Mac in Snow Leopard. I get the error when I launchtop. -
isomorphismes over 8 years@NicolasBarbulesco Ah ok Nicolas, sorry but I'm no longer using Mac so I can't test this with you. -
Ryan Griffith almost 7 yearsWorked for me when ran on the remove system. Connection from was OS X -> Ubuntu -
shevy over 6 yearsInterestingly, I had this error in a chroot-ed environment that has only minimal programs so far. I assume that there is some program missing that causes this, but unfortunately nano does not give more information as to why it exactly fails. -
shevy over 6 yearsI think this may be one reason why nano may sometimes fail - e. g. if the problem happens at ncurses/terminfo instead. -
Henning almost 6 yearsWorks also when trying to use top inside a minikube local kubernetes system running as a VM based on buildroot inside Virtualbox on Max OS X. (which is ssh from MacOS into a Buildroot based VM and tgen run top) -
Meetai.com over 5 yearsThe same solution seems correct for different systems, including Ubuntu/Debian and OSX (the OP's). How is this irrelevant? -
inspirednz almost 5 yearsThis worked for me on a Debian system. How do I make this permanent? Such as having it occur when I log in via SSH? -
das-g over 4 yearsWhile this may work (and even more generically than the "real" solutions) it's conceptually a workaround at best. You're essentially lying to your shell about the terminal you use to connect. -
Admin over 4 yearsFor anyone trying to get a chroot running on macOS, this fixes "Error opening terminal: " issue inside the chroot. -
Meetai.com over 4 yearsIt might be a "hack" that sheds light in the underlying issue. -
XavierStuvw over 3 yearsThis worked for me when ccmake, instead of nano, was issuing the same error message -
Gayan Kavirathne almost 3 yearsI ran to a similar situation when uding a chroot ssh configuration. And I fixed it as @Fortune has menstioned. find and copy terminfo folders to the chroot folder structure