skip to content
System Design in the Smoking Room
(AI translated)

Beautiful GIFs straight from your terminal

/ 3 min read

Table of contents

TLDR

Terminal window
# Install
npm install -g terminalizer
# Save the global config
terminalizer init
# Start a recording named test
terminalizer record -k test
# Render the recording into test.gif
terminalizer render test -o test.gif

Why you’d want it

This is more of a toy — you can always just record a region of your screen and convert it to a GIF — but here you get to do all of it right in the terminal.

On top of that, you can upload a recording to their site and send someone a link.

Installation and first run

To install it, you’ll need npm on your machine. Install it for all users:

Terminal window
npm install -g terminalizer

For Mac, brew won’t help, but on Arch you can use the builds from AUR.

Terminal window
# if you use yay
yay -S nodejs-terminalizer

That’s it, everything’s ready — go ahead and run it:

Terminal window
terminalizer record -k test

A new session will start in the current window. Poke around in it, connect over ssh — whatever you like — and when you’re done, just hit exit to stop the recording. You’ll end up with a preliminary file in the current directory that you can render into a GIF (in our case we recorded test, so a test.yaml file will show up):

Terminal window
terminalizer render test -o test.gif

Nice work! A test.gif file with your terminal recording has appeared in the current folder!

The main catch is that you’ll see your old, unconfigured terminal — forget about starship.rs, Oh-My-Posh or any other niceties. If you want to use the full power of terminalizer, you’ll need to configure it.

Configuration

By default, terminalizer takes the config from the current directory, or, if there isn’t one, from the ~/.config/terminalizer folder.

You can generate the default config with

Terminal window
terminalizer init

In the terminal you’ll see something like

The global config directory is created at
/Users/bob/.config/terminalizer

From then on, every terminalizer run will use this config. But each time you make a recording, a YAML file is generated that contains both the full config and the recorded frames — so when you’re dialing in your settings, it’s easier to edit that file than to change the global config and re-run the recording every time.

command

First things first, replace the launch command with your shell

# Specify a command to be executed
# like `/bin/bash -l`, `ls`, or any other commands
# the default is bash for Linux
# or powershell.exe for Windows
command: zsh

In my case, I replaced null with zsh

env

The next parameter worth a look is env:

# Export additional ENV variables
env:
recording: true

By default, when terminalizer starts, it sets the recording=true environment variable in the shell. That’s handy, for example, for skipping certain commands. For instance, every terminal of mine runs the pfetch tool.

To keep the output clean, my ~/.zshrc checks for the recording variable so that pfetch doesn’t show up inside terminalizer:

Terminal window
if [ -z "$recording" ]; then
pfetch
fi

The rest of the parameters are described well enough in the docs — whether it’s adding a watermark or tweaking the margins. Just don’t forget to point it at the fonts you have installed in your terminal.

Problems

Since we’re dealing with a pure JS tool, things can go wrong during installation (and sometimes while it’s running).

EACCESS

During installation you might run into something like this:

npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/zhurik/.npm/_logs/2025-03-14T09_48_06_223Z-debug-0.log

It’s a common problem, and the fix generally lives in the docs.

But if you can’t be bothered digging into it or reinstalling node and npm, you can just tell npm which folder to drop global packages into:

Terminal window
mkdir -p ~/.npm-global/lib
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' | tee -a ~/.profile
source .profile

Voilà — everything installs and just works.