How to download, compile, and install GNU ncurses on Debian/Ubuntu Linux?

ncurses is a programming library providing an API, allowing the programmer to write text user interfaces in a terminal-independent manner.

Here are the simple steps to download, configure, compile, and install ncurses on a Linux machine. I have tested these instructions on Debian/Ubuntu and CentOS Linux distributions but they should work on all Linux machines where compilers and make utility are installed. Please take a look at configuring Ubuntu Linux after installation to configure your Debian/Ubuntu Linux box for the required tools.

You can find the list of available ncurses versions at ncurses page. Please make sure you check the downloaded file's integrity before unzipping it. '#' (w/o quotes) in front of the command below means you have to run the command as root user (or use sudo <command>).

I downloaded and installed version 5.7.

$ wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.7.tar.gz
$ tar xzf ncurses-5.7.tar.gz
$ cd ncurses-5.7
$ ./configure --prefix=/opt/ncurses
$ make
# make install
$ ls -la /opt/ncurses

Thats it. Now you can use the ncurses to download, compile, and install MySQL cli.

Did this tutorial help a little? How about buy me a cup of coffee?

Buy me a coffee at ko-fi.com

Please feel free to use the comments form below if you have any questions or need more explanation on anything. I recommend thoroughy testing on a production-like test system first before moving to production.

Comments (write a comment):

Worked exactly as advertised, thank you for taking the time to document how to install ncurses for Debian/Ubuntu. Posted by: CBE on Oct 08, 2011

I got exactly what i wanted. Posted by: viswanath on Jul 26, 2012

ncurses no install. What do?

Dhave Posted by: Dhave H Config on Feb 18, 2013

@Dhave: are you getting any error messages from any of the commands above? Posted by: shahryar on Feb 22, 2013

Will it work for CENTOS 64bit system? Posted by: S M shafiqul islam on Feb 25, 2014

Worked perfectly... thanks! Posted by: Abara on Mar 30, 2014

@S M: I haven't tested that yet but may be you can and share the results with us :) Posted by: Shahryar on Apr 08, 2014

getting error
configure: error: no acceptable cc found in $PATH
pleaase help Posted by: SHUBHAM SHARMA on Aug 10, 2014

Thanks really simplified example of how to download and install a package in linux Posted by: dhiraj on Dec 04, 2014

when i type make install then following error is coming

mkdir: cannot create directory ‘/opt/ncurses/man’: No such file or directory
make[1]: *** [/opt/ncurses/man] Error 1
make[1]: Leaving directory `/home/techmahindra/ncurses-5.7/man'
make: *** [install] Error 2 Posted by: apurva on Sep 21, 2015

@apurva: looks like a file permission issue.

Did you run 'make install' as root or some other user? Did you make sure /opt directory already exists? Posted by: geeksww on Oct 13, 2015

when i try make install
i too got similar error
make[1]: Entering directory '/home/ganeshkvvn/ncurses-6.0/man'
mkdir -p /opt/ncurses/share/man
mkdir: cannot create directory ‘/opt/ncurses’: Permission denied
Makefile:60: recipe for target '/opt/ncurses/share/man' failed
make[1]: *** [/opt/ncurses/share/man] Error 1
make[1]: Leaving directory '/home/ganeshkvvn/ncurses-6.0/man'
Makefile:113: recipe for target 'install' failed
make: *** [install] Error 2
even i tried in root user but doesn't works Posted by: ganesh kvvn on Jan 01, 2016

@ganesh: it clearly looks like a permission issue.

You need proper permissions to create a directory in /opt.

Try

the sudo command for make install

sudo make install

or run it as 'root' user (if possible but not recommended). Posted by: shahryar on Feb 02, 2016

Shahryar. I followed the step as above, at the point of "make install" i too get the same error
make[1]: Entering directory '/home/csee1/adwayak1/ncurses-6.0/man'
mkdir -p /opt/ncurses/share/man
mkdir: cannot create directory �/opt/ncurses�: Permission denied
make[1]: *** [/opt/ncurses/share/man] Error 1
make[1]: Leaving directory '/home/csee1/adwayak1/ncurses-6.0/man'
make: *** [install] Error 2.
And i am not registered user on sudo. Hence cant use the sudo command Posted by: Adwaya Kulkarni on Feb 08, 2016

@Adwaya: Its the same error again

"/opt/ncurses" requires permission to be written to (including directory creation), so you need to make sure you have the permissions. A simple test would be creating a test directory in /opt

mkdir /opt/test

if it does not work then you need the right permission first. Posted by: Shahryar on Mar 14, 2016

Hi, I am installing ncurses5.7 in RHEL.

when I run make command following error occurs.

/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
make[1]: *** [tic] Error 1
make[1]: Leaving directory `/root/ncurses-5.7/progs'
make: *** [all] Error 2

Note - Before 8 months in same machine I was able to install ncurses successfully.

Please help me as soon as possible. Posted by: sim on Apr 26, 2018

leave a comment on tutorial leave a comment