Home FAQ How To Install Ncurses Library In Linux
Install Ncurses Library In Linux

How To Install Ncurses Library In Linux

By sk
1845 Views

GNU Ncurses is a programming library that allows the users to write text-based user interfaces(TUI). Many text-based games have been created using this library. One popular example is PacVim, a CLI game to learn VIM commands. In this brief tutorial, we will be discussing how to install Ncurses library in Unix-like operating systems.

Install Ncurses Library In Linux

Ncurses is available in the default repositories of most Linux distributions. For  instance, you can install it on Arch-based systems using the following command:

$ sudo pacman -S ncurses

On RHEL, CentOS:

$ sudo yum install ncurses-devel

On Fedora 22 and newer versions:

$ sudo dnf install ncurses-devel

On Debian, Ubuntu, Linux Mint:

$ sudo apt-get install libncurses5-dev libncursesw5-dev

The GNU ncureses might be bit old in the default repositories. If you want a most recent stable version, you can compile and install from the source as shown below.

Download the latest ncurses version from here. As of writing this guide, the latest version was 6.1.

$ wget https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.1.tar.gz

Extract the tar file:

$ tar xzf ncurses-6.1.tar.gz

This will create a folder named ncurses-6.1 in the current directory. Cd to the directory:

$ cd ncurses-6.1
$ ./configure --prefix=/opt/ncurses

Finally, compile and install using the following commands:

$ make
$ sudo make install

Verify the installation using command:

$ ls -la /opt/ncurses

That's it. Ncurses have been installed on the Linux distribution. Go ahead and create your nice looking TUIs using Ncurses.

More good stuffs to come. Stay tuned!

Cheers!

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like

3 comments

Edgar Hoffmann December 24, 2018 - 12:54 am

Hi.
Thanks for this tutorial, I was able to install ncurses as suggested.

But now I experience a problem when I try to compile calcurse.
Configure says:
checking for initscr… no
checking for initscr in -lncursesw… no
checking for initscr in -lncurses… no
configure: error: Either ncurses or ncursesw library is required to build calcurse!

I tried it with
./configure –includedir=/opt/ncurses/bin

But had no success.
Maybe you can give me a hint how to handle this?

Reply
sk December 24, 2018 - 11:46 am

I don’t have any solution right now. My apologies. But why are you compiling it from source? Calcurse is available in the official repositories of most Linux distributions. https://calcurse.org/downloads/

Reply
abdulla95 April 10, 2020 - 10:18 am

@Edgar Hoffmann,

Use:

./configure –with-local-dir=/opt/ncurses

I used ” ./configure –help ” to find this command. This helped my installation of Vim.

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More