Linux Error: curses.h: No such file or directory Problem Solution

I see the following error when I run make command to install specific software:

curses.h: No such file or directory Problem Solution

How do I fix this error under Red Hat Enterprise Linux (RHEL) or CentOS / Fedora Linux?

You need to install the curses library which include routines for a terminal-independent method of updating character screens with reasonable optimization. The ncurses (new curses) library is a freely distributable replacement for the discontinued 4.4 BSD classic curses library.

Fix this error on RHEL / Fedora / CentOS Linux

Type the following yum command at a shell prompt as root user:
# yum install ncurses-devel ncurses
Sample output:

Loading "downloadonly" plugin
Loading "rhnplugin" plugin
Loading "security" plugin
rhel-x86_64-server-vt-5   100% |=========================| 1.2 kB    00:00     
rhel-x86_64-server-5      100% |=========================| 1.2 kB    00:00     
Setting up Install Process
Parsing package install arguments
Package ncurses - 5.5-24.20060715.x86_64 is already installed.
Package ncurses - 5.5-24.20060715.i386 is already installed.
Resolving Dependencies
--> Running transaction check
---> Package ncurses-devel.x86_64 0:5.5-24.20060715 set to be updated
---> Package ncurses-devel.i386 0:5.5-24.20060715 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

 Package                 Arch       Version          Repository        Size 
 ncurses-devel           x86_64     5.5-24.20060715  rhel-x86_64-server-5  1.7 M
 ncurses-devel           i386       5.5-24.20060715  rhel-x86_64-server-5  1.6 M

Transaction Summary
Install      2 Package(s)         
Update       0 Package(s)         
Remove       0 Package(s)         

Total download size: 3.3 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): ncurses-devel-5.5- 100% |=========================| 1.6 MB    00:01     
(2/2): ncurses-devel-5.5- 100% |=========================| 1.7 MB    00:01     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: ncurses-devel                ######################### [1/2] 
  Installing: ncurses-devel                ######################### [2/2] 

Installed: ncurses-devel.x86_64 0:5.5-24.20060715 ncurses-devel.i386 0:5.5-24.20060715

Fix this error on Debian / Ubuntu Linux

Open terminal and type the following apt-get command to install ncurses:
$ sudo apt-get install libncurses5-dev libncursesw5-dev

Now you should able to compile any program under Linux using ncurses. Here is a sample command to compile and use ncurses:
$ gcc -o output input.c -lncurses
$ ./output

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 21 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
21 comments… add one
  • Mike Mar 3, 2010 @ 3:34

    cool thanks

  • bobo Jun 25, 2010 @ 22:18

    Thanks! It helps me a lot.

  • rootnet47 Mar 18, 2011 @ 6:53

    I installed libncursesw5-dev in ubuntu by using
    $ sudo apt-get install libncurses5-dev libncursesw5-dev
    command and also checked in synaptic package manager but I’m still facing the same problem when I’m going to compile in gcc.

    • Edward Apr 17, 2012 @ 0:21

      Well, maybe you forgot to add “-lncurses” at the end of command.
      Like this:
      gcc -o game main.c -lncurses

      I hope this may help you.

      • sagar Oct 7, 2016 @ 16:34

        thanks Edward, including -lncurses solved my compilation problem.

    • Edward Apr 17, 2012 @ 6:23

      Oh! Perhaps the setings of curses on your computer hadn’t been set to use ncurses lib automaticly. You may use ” ls -l /usr/include/curses.h” to check this. If curses.h is not a link to ncurses.h (or ncurses.h is not a link to curses.h), you need to add ” -I /usr/include/ncurses ” to use lib ncurses forcely.

  • stone Sep 9, 2011 @ 7:20

    cool, thanks

  • Parker Sep 12, 2011 @ 16:22

    Thanks buddy…

  • Krishna Pandey Apr 26, 2012 @ 13:55

    Thanks Pal, I was installing cscope on RHEL 6, on which I had ncurses package installed already. ncurses-devel package did the magic.

  • Akshay Oct 1, 2012 @ 17:33

    Thanks for the help!

  • Edwin Jose May 7, 2013 @ 18:01

    When I’m trying this “sudo apt-get install libncurses5-dev libncursesw5-dev”
    the follwoing error occur;

    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Unable to locate package libncruses5-dev
    E: Unable to locate package libncrusesw5-dev

    • Edward May 22, 2013 @ 11:36

      You can use “apt-cache search ncurses ncursesw” to find out what the exactly name.

  • suhasini Nov 8, 2013 @ 10:55

    i done “yum install ncurses-devel ncurses” and installed properly… den also i am getting error
    [root@localhost ~]# ./configure
    bash: ./configure: No such file or directory
    plz help me ..plz

  • Deepak B Jan 16, 2014 @ 18:29

    $ which ncurses

    /usr/bin/which: no ncurses in (/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/db667u/bin:/usr/bin)

    $ rpm -qa|grep ncurses


    Looks ncurses is installed but still am not able to run it, anybody can help me please?

  • opshlds Apr 15, 2014 @ 15:48

    Old post, I know, but thank you most kindly for the answer as it’s solved an issue I was having compiling SBBS on my system! Many thanks!

  • sugatang itlog Jul 17, 2014 @ 3:45

    Solved my issues as well. And nice tweets. More power nixCraft!

  • Muhammad Waleed Sep 2, 2014 @ 5:50

    i have tried to run that yum command but i am still getting this error .
    Loaded plugins: refresh-packagekit, rhnplugin
    This system is not registered with RHN.
    RHN support will be disabled.
    Setting up Install Process
    No package ncurses-devel available.
    Nothing to do
    plz help me . i am trying but nothing is helping me .
    i am using red hat .

  • Muhammad Waleed Sep 2, 2014 @ 6:27

    i have also used sudo command but it is not working . i having this error . i entered my password for user then got this error my user is waleed .
    waleed is not in the sudoers file. This incident will be reported..
    help needed urgently .

    • GKFX Jan 2, 2015 @ 14:00

      You aren’t allowed to install software. If you are the owner of this computer, that’s a serious problem: you’ll need to get it fixed. More likely, you don’t own the computer, so you need to ask the owner/technician/etc to install it for you.

  • Runcy May 11, 2015 @ 11:11


Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum