简体   繁体   中英

ncurses on macOS (OSX) cannot find xterm-256color

I'm trying to use ncurses 6.0 on macOS. I've downloaded the project and built the C++ demo using the supplied makefiles. However, when I run the demo, I get the error:

Error opening terminal: xterm-256color.

This might be related: I do not have an x folder in my terminfo directory:

$ ls /usr/share/terminfo/
31  36  45  51  64  69  6e  73  78
32  37  4c  58  65  6a  6f  74  7a
33  38  4d  61  66  6b  70  75
34  39  4e  62  67  6c  71  76
35  41  50  63  68  6d  72  77

The demo works correctly on Debian.


The output of my configuration is:

** Configuration summary for NCURSES 6.0 20150808:

       extended funcs: yes
       xterm terminfo: xterm-new

        bin directory: /usr/local/bin
        lib directory: /usr/local/lib
    include directory: /usr/local/include/ncurses
        man directory: /usr/local/share/man
   terminfo directory: /usr/local/share/terminfo

** Include-directory is not in a standard location

Because I'm lazy and don't read manuals I did not run the full setup procedure. After running:

./configure
make
make install

It now works.

When you built ncurses, the configure script tells you at the end where it will install. If you give no options on OSX, it will look like this:

creating headers.sh

** Configuration summary for NCURSES 6.0 20160409:

       extended funcs: yes
       xterm terminfo: xterm-new

        bin directory: /usr/local/bin
        lib directory: /usr/local/lib
    include directory: /usr/local/include/ncurses
        man directory: /usr/local/share/man
   terminfo directory: /usr/local/share/terminfo

** Include-directory is not in a standard location

You can override the location of the terminfo directory (read the INSTALL file), or tell the library at runtime by setting the TERMINFO and/or TERMINFO_DIRS environment variables. But without doing one of those things, it will look for the terminal database in a different location.

The ncurses configure script supplies a --prefix=/usr option for some systems (mainly Linux-based) because it is expected to be the system curses library (again, read INSTALL ). OSX is not the odd one here.

OSX is different from the usual case: its filesystem (usually) ignores the difference between upper/lowercase names. The configure script checks for this, and if so, it compiles in a workaround to encode those single letters as a hexadecimal number. For example, 0x78 is "x".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM