Need help with cxxmatrix?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

551 Stars 57 Forks MIT License 66 Commits 0 Opened issues


C++ Matrix: The Matrix Reloaded in Terminals (Number falls, Banners, Matrix rains, Conway's Game of Life and Mandelbrot set)

Services available


Need anything else?

Contributors list

# 71,492
61 commits
# 293,247
1 commit
# 537,550
1 commit
# 66,224
1 commit

C++ Matrix in terminal

I wrote a simple terminal program of Matrix digital rain. A part of the purpose of this program is to test the performance of terminal emulators. Another purpose is just for fun. Enjoy it with fast terminals (e.g., urxvt, alacritty, terminology, etc.)!


  • Hankaku kana characters as in the original film
  • Ten levels of "green"s using terminal 256 color support
  • Twinkling effects by adding random brightness fluctuations
  • Diffused reflection effects by cell background colors


By default, the following scenes will be visited in turn. If you want to see each scene, please see the help (

cxxmatrix --help
  1. Number falls
  2. Banner - Show command line arguments by shining characters
  3. "The Matrix" rain - Wikipedia
  4. Conway's Game of Life - Wikipedia
  5. The Mandelbrot set - Wikipedia
  6. (End scene) "The Matrix" rain


  • cxxmatrix in 80x28 - Youtube
  • The Mandelbrot set in 479x186 - YouTube
  • Highlight scenes - See the animated GIF below



This program is provided under the MIT License.


  • git, C++17 compiler, GNU make, GNU awk
  • UTF-8 support of the system
  • a fast terminal with
    and UTF-8 support

Compile and Run

$ git clone
$ cd cxxmatrix
$ make
$ ./cxxmatrix 'The Matrix' 'Reloaded'

Quit: C-c; Suspend: C-z; Menu: RET, C-m

Compile MSYS2 binary (MSYS2 PTY) using MSYS2

The MSYS package

is required in order to use the MSYS2 compiler.
msys2$ pacman -Syu
msys2$ pacman -S git gawk make msys2-devel
msys2$ git clone
msys2$ cd cxxmatrix
msys2$ PATH=/usr/bin:$PATH make

Compile Windows binary (ConPTY) using MinGW/MSYS2

The Windows binary based on Windows Pseudo Console API (ConPTY) can be compiled on MinGW/MSYS2 by passing

. It should be noted that ConPTY is extremely slow.
msys2$ pacman -Syu
msys2$ pacman -S git gawk make mingw-w64-x86_64-gcc
msys2$ git clone
msys2$ cd cxxmatrix
msys2$ PATH=/mingw64/bin:$PATH make TARGET=win32


Check the help with

cxxmatrix --help
$ ./cxxmatrix --help
cxxmatrix (C++ Matrix)
usage: cxxmatrix [OPTIONS...] [[--] MESSAGE...]

MESSAGE Add a message for 'banner' scene. When no messages are specified, a message "C++ MATRIX" will be used.

OPTIONS --help Show help -- The rest arguments are processed as MESSAGE -m, --message=MESSAGE Add a message for 'banner' scene. -s, --scene=SCENE Add scenes. Comma separated list of 'number', 'banner', 'rain', 'conway', 'mandelbrot', 'rain-forever' and 'loop'. -c, --color=COLOR Set color. One of 'default', 'black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', integer 0-255 (256 index color), '#RGB', and '#RRGGBB'. --colorspace=COLORSPACE Set colorspace. One of 'default'/'xterm-256'/'256', 'ansi-8'/'8', 'aix-16'/'16', 'xterm-88'/'88', 'xterm-rgb', 'iso-rgb'/'rgb', 'iso-cmy'/'cmy', 'iso-cmyk'/'cmyk', or 'iso-index'/'index'. --frame-rate=NUM Set the frame rate per second. A positive number less than or equal to 1000. The default is 25. --error-rate=NUM Set the factor for the rate of character changes. A non-negative number. The default is 1.0. --diffuse --no-diffuse Turn on/off the background-color effect. Turned on by default. --twinkle --no-twinkle Turn on/off the twinkling effect. Turned on by default. --preserve-background --no-preserve-background Preserve terminal background or not. Not preserve by default. --rain-density=NUM Set the factor for the density of rain drops. A positive number. The default is 1.0.

Keyboard C-c (SIGINT), q, Q Quit C-z (SIGTSTP) Suspend C-m, RET Show menu

Select scenes

# Example: Show the Mandelbrot set
./cxxmatrix -s mandelbrot

Example: Loop Number falls and Conway's Game of Life

./cxxmatrix -s number,conway,loop


sudo make install

The default install prefix is

. The following files will be created:
  • /usr/local/bin/cxxmatrix
  • /usr/local/share/man/man1/cxxmatrix.1.gz
  • /usr/local/share/licenses/cxxmatrix/

The make variable

can be specified to change the install prefix. To copy files in a temporary location, the make variable
can also be specified. To change the subdirectory of
, the make variable
(whose detault value is
) can be adjusted.
# Example 1: install cxxmatrix in user directory
make install PREFIX=~/.local

Example 2: install cxxmatrix in /opt

sudo make install PREFIX=/opt/cxxmatrix

Example 3: create a package

make install DESTDIR=/tmp/packages/cxxmatrix PREFIX=/usr/local

Example 4: put in /usr/local/share/cxxmatrix

sudo make install INSTALL_SUBDIR_LICENSE=share/cxxmatrix

See also

Similar projects

Related tags in GitHub:

In each section, the projects are ordereded by the number of stars, which is shown in parentheses for each project. This list including the numbers of stars is updated when

is updated so does not reflect the current status. The numbers of stars are last updated on 2021-12-27 10:05:04 JST.

The Matrix rains in terminals

The Matrix rains in browsers



We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.