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.

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105

2 Answers2

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.

filmor
  • 30,840
  • 6
  • 50
  • 48
Enfors
  • 960
  • 2
  • 14
  • 25
  • 1
    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!! – Vivek M. Chawla Feb 15 '13 at 17:55
  • 1
    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! – squeegee Dec 09 '14 at 01:37
2

I fixed this in Mac OS Catalina with,

export TERMINFO=/usr/share/terminfo
amirathi
  • 436
  • 4
  • 7