Skip to content

Installation

uncurses is pure Rust with a tiny dependency footprint. Add it, keep the default width backend or pick another one, and you are ready to draw.

Add the dependency

uncurses is not on crates.io yet, so depend on it straight from git:

[dependencies]
uncurses = { git = "https://github.com/aymanbagabas/uncurses" }

Using the ratatui backend too? Add the core crate, the backend crate, and ratatui:

[dependencies]
uncurses = { git = "https://github.com/aymanbagabas/uncurses" }
uncurses-ratatui = { git = "https://github.com/aymanbagabas/uncurses" }
ratatui = "0.30"

Feature flags

Every app needs a width backend, since terminal layout is measured in cells and some characters are two cells wide. uncurses ships two, and you pick one.

FeatureDefaultWhat it does
unicode-rsyesPure-Rust width and segmentation tables. Small build, conservative on emoji and zero-width-joiner edge cases.
icunoICU4X-backed segmentation and Unicode properties. Strictly more correct on the tricky clusters, at the cost of a larger binary. Wins when both are on.
asyncnoAdds EventStream, a runtime-agnostic futures_core::Stream of decoded events. Pulls in only futures-core, no executor.

The default is unicode-rs. If you turn default features off, choose unicode-rs or icu; building without a width backend fails. To trade size for correctness, switch to icu:

[dependencies]
uncurses = { git = "https://github.com/aymanbagabas/uncurses", default-features = false, features = ["icu"] }

To await events instead of blocking a thread, add async:

[dependencies]
uncurses = { git = "https://github.com/aymanbagabas/uncurses", features = ["async"] }

Supported platforms

CI covers Linux (glibc and musl), macOS, Windows, FreeBSD, OpenBSD, NetBSD, illumos, and Solaris. uncurses does not use terminfo and assumes a modern, VT100/xterm-compatible terminal, so there is no platform database to install and no per-terminal configuration to manage.

Rust version

uncurses uses the 2024 edition, currently needs Rust 1.88 or newer, and tracks the latest stable toolchain. There is no separate toolchain or build step: a normal cargo build is all it takes.

Next steps

With the crate added, the next page writes the smallest complete program: Hello, terminal.