cbonsai grows bonsai trees in your terminal — procedurally generated, colored by season, and animated as they grow. Every tree is different: the engine grows a trunk that wanders, leans, widens, and forks, then clothes it in procedural foliage and the occasional patch of weathered deadwood.
bonsai-loop.mp4
30 trees, grown live. this implementation of cbonsai began as a fork of John Allbritten's cbonsai; it has since diverged a long way downstream (a rewritten growth engine, procedural foliage, structural trunks, seasonal color, and persistent real-time growth).
Seasonal palettes — chosen automatically from the date, or forced with
--season:
early fall · late fall · winter
Falling leaves, with --falling-leaves:
falling-leaves.mp4
A giant tree, with a message alongside it:
- Procedural foliage — leaves grow as drifting walkers that pool into canopy
pads rather than a symmetric blob (
-P). - Structural branching — the branch multiplier drives bold structure (leans, committed forks) instead of a radial explosion.
- Trunk widening & taper — trunks thicken at the base and taper as they climb, fork by fork.
- Deadwood (jin/shari) — limbs occasionally grow, then die back to bare, bleached wood.
- Seasonal color — spring greens through summer depth, autumn yellows and
reds, winter whites; automatic by date or pinned with
--season. - Falling leaves — leaves flutter and tumble down from the canopy, in the
seasons you choose (
--falling-leaves, off by default). - Live growth — watch each step, at a speed you choose.
- Named, persistent trees — a tree can grow over days or weeks of real time, even while the program isn't running.
- Messages — display text beside the tree, with an optional timeout.
- Save / load — persist and resume tree state.
- Versioned engines — the growth algorithm is versioned; a saved tree always replays under the engine it was created with, so updates never reshape old trees.
You'll need a working ncursesw / ncurses library.
brew install ncurses
git clone https://github.com/jakobrees/cbonsai.git
cd cbonsai
gcc -Wall -Wextra -Wshadow -Wpointer-arith -Wcast-qual -pedantic \
-I$(brew --prefix)/opt/ncurses/include \
-L$(brew --prefix)/opt/ncurses/lib \
src/cbonsai.c src/msaw.c -o cbonsai \
$(brew --prefix)/opt/ncurses/lib/libncurses.a \
$(brew --prefix)/opt/ncurses/lib/libpanel.asudo apt install build-essential libncurses-dev pkg-config
git clone https://github.com/jakobrees/cbonsai.git
cd cbonsai
make install PREFIX=~/.localsudo pacman -S --needed base-devel ncurses
git clone https://github.com/jakobrees/cbonsai.git
cd cbonsai
make install PREFIX=~/.localnix run github:jakobrees/cbonsaisudo dnf install gcc make ncurses-devel pkgconf-pkg-config
git clone https://github.com/jakobrees/cbonsai.git
cd cbonsai
make install PREFIX=~/.localUsage: cbonsai [OPTION]...
Options:
-l, --live live mode: show each step of growth
-t, --time=TIME in live mode, wait TIME secs between
steps of growth (must be larger than 0) [default: 0.03]
-P, --procedural enable procedural leaf generation mode
-i, --infinite infinite mode: keep growing trees
-w, --wait=TIME in infinite mode, wait TIME between each tree
generation [default: 4.00]
-S, --screensaver screensaver mode; equivalent to -li and
quit on any keypress
-m, --message=STR attach message next to the tree
-T, --msgtime=SECS clear message after SECS seconds
-b, --base=INT ascii-art plant base to use, 0 is none
-c, --leaf=LIST list of comma-delimited strings randomly chosen
for leaves
-M, --multiplier=INT branch multiplier; higher -> more
branching (1-20) [default: 10]
-N, --name=TIME create a named tree that grows over real time,
where TIME is life of tree in seconds.
MUST be used with -W to specify a save file.
(automatically enables -l and -P)
-L, --life=INT life; higher -> more growth (10-500) [default: 60]
-p, --print print tree to terminal when finished
-s, --seed=INT seed random number generator
--engine=INT tree generation engine version for new trees
(1 or 2) [default: 2]; loaded trees use
their saved version
--bare suppress foliage; draw only the woody structure
(v2 engine only; same tree, leaves hidden)
--season=NAME force seasonal colors instead of using the date:
spring, summer, autumn, late-autumn, winter
--falling-leaves[=STYLE]
let leaves drift down from the tree; STYLE
is dots (braille) or lines [default: dots]
--falling-rate=NUM falling leaves per second [default: 1.1]
--falling-speed=NUM
how fast leaves fall; 2 is twice as fast
(0.1-5) [default: 1]
--falling-seasons=LIST
comma-delimited seasons in which leaves
fall, e.g. autumn,winter; autumn covers
early-autumn and late-autumn [default: all]
-W, --save=FILE save progress to file [default: ~/.cache/cbonsai]
-C, --load=FILE load progress from file [default: ~/.cache/cbonsai]
-v, --verbose increase output verbosity
--version show version
-h, --help show help
# A simple tree
cbonsai
# Watch one grow, live
cbonsai -l
# A big, tall tree (low multiplier grows tall and slender)
cbonsai -l -L 200 -M 4
# Pin the season regardless of the date
cbonsai --season winter
# A tree with a message beside it, cleared after 10s
cbonsai -m "Happy Birthday!" -T 10A named tree keeps growing in real time, even when cbonsai isn't running — it records when it was created and advances to the present each time you load it.
# Create a tree that grows over 30 days (2,592,000 seconds)
cbonsai -N 2592000 -W ~/my_tree
# Load it later and let it catch up to now
cbonsai -C ~/my_tree# Saves/loads automatically; quits on any keypress
cbonsai -S# Leaves drift down from the canopy, as braille dots or as lines
cbonsai -S --falling-leaves
cbonsai -S --falling-leaves=lines
# Only in autumn and winter, and fewer of them
cbonsai -S --falling-leaves --falling-seasons=autumn,winter --falling-rate=0.5echo "cbonsai -p" >> ~/.bashrcThe trunk and branches are grown by an iterative simulation: each branch is a walker with its own life, age, and lean that wanders, rises, sprouts shoots, and occasionally forks, while procedural walkers grow the foliage on top. Randomness comes from deterministic per-stream generators, so a given seed always produces the same tree — and cosmetic-only streams are kept separate from the growth stream so visual tweaks never reshape a saved tree.
The growth algorithm is versioned. New trees use the latest engine (v2);
trees loaded from a save file replay under whatever engine they were created
with, so algorithm updates never change the look of an existing tree. Pass
--engine to choose the engine for new trees.
Found a bug, or have a fix? Open an issue; see CONTRIBUTING.md.
cbonsai is a fork of cbonsai by John Allbritten,
which was itself inspired by earlier terminal bonsai generators. Thanks to John and
those prior authors for the original idea and foundation.
GNU General Public License. See LICENSE.




