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

Beautiful GIFs straight from your terminal v2.0.0

/ 3 min read

Table of contents

TLDR

GitHub

Install:

Terminal window
# MacOS
brew install t-rec
# or
sudo port selfupdate
sudo port install t-rec
# Arch
yay -S t-rec
# Deb
sudo snap install t-rec --classic
# or
sudo apt-get install libx11-dev imagemagick
cargo install -f t-rec

Commands:

Terminal window
t-rec --init-config
t-rec --list-profiles
t-rec -q
t-rec -q -o ~/Documents/recordings/record_1

Shell function:

Terminal window
record() {
if [ -z "$1" ]; then
echo "Missing filename"
return 1
fi
TREC_RECORDING=1 t-rec -q -o ~/Documents/recordings/"$1"
}

Why

The reasons are the same ones I covered back when I wrote about terminalizer. I’d still be recommending it if it weren’t for the constant fights with npm every time I need to record something, which is once every two or three months. Development there has also slowed to a crawl.

So I found a replacement: it’s written in Rust, and its name is a nod to dinosaurs.

Why look for anything better?

Installation

The source code lives on GitHub, and that’s where you’ll find the docs too.

On macOS, you can get it from either Homebrew or MacPorts.

Homebrew:

Terminal window
brew install t-rec

MacPorts:

Terminal window
sudo port selfupdate
sudo port install t-rec

There’s a package for Arch out of the box:

Terminal window
yay -S t-rec

And even a snap for Ubuntu or Debian:

Terminal window
sudo snap install t-rec --classic

And as usual with Rust tools, you can just build it from source with cargo:

Terminal window
git clone https://github.com/sassman/t-rec-rs.git
cd t-rec-rs
cargo install -f --path .

And, as tradition demands, check that everything works:

Terminal window
t-rec --version
Version

Usage

Running it couldn’t be simpler:

Terminal window
t-rec

To stop recording, hit Ctrl+D.

I don’t love the Ctrl+D reminder either, so I add the -q flag.

You can also tell it where to save the output. Say you have a ~/Documents/recordings folder and want to save a new recording called new-record there. It’d look something like this:

Terminal window
t-rec -q -o ~/Documents/recordings/new-record

Leave off the extension: t-rec adds it for you, depending on whether it’s a GIF or a video.

Or just wrap the whole thing in a function:

Terminal window
record() {
if [ -z "$1" ]; then
echo "Missing filename"
return 1
fi
t-rec -q -o ~/Documents/recordings/"$1"
}

And run it like this:

Terminal window
record new-record

Profiles

t-rec has tons of settings: for example, you can set a background for the final recording, that sort of thing. The docs have great examples for all of it.

A profile is a set of options applied to a recording. Generating a default config with the standard profiles is easy:

Terminal window
t-rec --init-config

To list the available ones:

Terminal window
t-rec --list-profiles

And, unsurprisingly, the --profile flag runs it with a specific profile:

Terminal window
t-rec --profile demo

Honestly, I still haven’t figured out why I’d need them: the defaults work just fine for me. Although with the latest macOS update, the window corners are rounded in a pretty ugly way…

Anyway, if I ever figure out that profiles are worth setting up, I’ll add that here.

Env

Like last time, I’ve got a ton of stuff in my .zshrc that I don’t always want showing up in GIFs. t-rec’s approach is either hackier or saner, I can’t decide which, but you can key off a specific environment variable and show (or skip) things based on it:

Terminal window
TREC_RECORDING=1 t-rec

Then in .zshrc:

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

Now pfetch won’t show up in your recordings, and the function becomes:

Terminal window
record() {
if [ -z "$1" ]; then
echo "Missing filename"
return 1
fi
TREC_RECORDING=1 t-rec -q -o ~/Documents/recordings/"$1"
}

Wrapping up

I skipped the fact that it can record arbitrary windows, not just the terminal. I think this is a solid starting point. If I come up with anything else, I’ll add it as I go.

Now go record a slick demo for your AI B2B SaaS!

Take care of yourselves and your loved ones!