Beautiful GIFs straight from your terminal v2.0.0
/ 3 min read
Table of contents
TLDR
Install:
# MacOSbrew install t-rec# orsudo port selfupdatesudo port install t-rec
# Archyay -S t-rec
# Debsudo snap install t-rec --classic# orsudo apt-get install libx11-dev imagemagickcargo install -f t-recCommands:
t-rec --init-configt-rec --list-profilest-rec -qt-rec -q -o ~/Documents/recordings/record_1Shell function:
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:
brew install t-recMacPorts:
sudo port selfupdatesudo port install t-recThere’s a package for Arch out of the box:
yay -S t-recAnd even a snap for Ubuntu or Debian:
sudo snap install t-rec --classicAnd as usual with Rust tools, you can just build it from source with cargo:
git clone https://github.com/sassman/t-rec-rs.gitcd t-rec-rscargo install -f --path .And, as tradition demands, check that everything works:
t-rec --version
Usage
Running it couldn’t be simpler:
t-recTo 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:
t-rec -q -o ~/Documents/recordings/new-recordLeave 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:
record() { if [ -z "$1" ]; then echo "Missing filename" return 1 fi
t-rec -q -o ~/Documents/recordings/"$1"}And run it like this:
record new-recordProfiles
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:
t-rec --init-configTo list the available ones:
t-rec --list-profilesAnd, unsurprisingly, the --profile flag runs it with a specific profile:
t-rec --profile demoHonestly, 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:
TREC_RECORDING=1 t-recThen in .zshrc:
if [ -z "$TREC_RECORDING" ]; then pfetchfiNow pfetch won’t show up in your recordings, and the function becomes:
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!
