tput: unknown terminal
Asked Answered
O

2

12

I'm on AIX-6.1 and I'm trying to make use of tput inside my $PS1. I've confirmed I can't even run tput from the commandline. Following is my session:

# tput
unknown terminal "xterm"
# echo $TERM
xterm
# tput -T ansi
unknown terminal "ansi"

In fact, ...

# ls /usr/lib/terminfo/x
x1700  xl83        xterm+pcc3  xterm+pcfkeys   xterm-88color  xterm-hp     xterm-old  xterm-vi
x1720  xtalk       xterm+pcf0  xterm+pcfn      xterm-8bit     xterm-ic     xterm-r5   xterm-vt220
x1750  xterm       xterm+pcf1  xterm-16color   xterm-basic    xterm-mono   xterm-r6   xterm-vt52
x820   xterm+pcc0  xterm+pcf2  xterm-24        xterm-bold     xterm-new    xterm-rep  xterm-xfree86
xdku   xterm+pcc1  xterm+pcf3  xterm-256color  xterm-boldso   xterm-noapp  xterm-sco  xterm-xmc
xitex  xterm+pcc2  xterm+pcfN  xterm-65        xterm-color    xterm-nrc    xterm-sun  xterms
# ls /usr/lib/terminfo/x | wc -l
       48
# for term in $(ls /usr/lib/terminfo/x) ; do tput -T $term ; done 2>&1 | grep 'unknown terminal' | wc -l
      48
# for term in $(ls /usr/lib/terminfo/x) ; do TERM=$term tput ; done 2>&1 | grep 'unknown terminal' | wc -l
  48

Any ideas? Thanks in advance.

Odysseus answered 28/4, 2009 at 19:55 Comment(0)
F
14

Is your TERMINFO variable set? Without it, I believe the system won't find your terminfo files. Or perhaps it is set incorrectly?

If you're running sh, ksh, bash or similar, try:

export TERMINFO=/usr/lib/terminfo

If you're not sure what shell you're using (I'm pretty sure you do, but others might read this too), type:

echo $SHELL

If you're using csh, tcsh or similar, then you should instead type:

setenv TERMINFO /usr/lib/terminfo

After that, try running tput again.

Fernand answered 31/10, 2009 at 9:50 Comment(2)
Thank you for this answer, Enfors! I was having a problem with Drush on Ubuntu 12.04 throwing me a "tput: unknown terminal..." error each time I executed a Drush command. Your advice fixed my problem. Thanks!!Wedged
I had this issue under MSYS2 on Windows (x86_64). It was working, then I installed gcc and a few tools and it started failing. Anyway, adding a conditional export of TERMINFO fixed it. Thanks!Emigrate
R
3

I fixed this in Mac OS Catalina with,

export TERMINFO=/usr/share/terminfo
Rosemarie answered 31/10, 2019 at 15:19 Comment(1)
This was also the location on Pop!_OS 20.04 LTSCriminal

© 2022 - 2024 — McMap. All rights reserved.