How to use Node.js to make animated terminal gifs

By Ev Bogue - August 19th 2015

Animated Gifs! I know so retro.

I was wondering how people were creating little animated gifs of their terminal-based programming projects for their README files, and I went down a bit of a rabbit hole to find a terminal-based recording program. I tried out a whole bunch of things, such as ttygif and tty2gif. tty2gif didn't seem to work, and ttygif appeared be a big hassel.

I poked around a little more and behold! I found a terminal recording application written in Node.js! It is called ttystudio

To install, you need to be running the latest version of Node.js. Right now thats 0.12.7. ttystudio doesn't work with io.js, which is node-gyp's fault. Almost everything that goes wrong with Node.js is node-gyps fault. Anyway, node-gyp needs to fix a problem that's messing up their compatibility with io.js.

So if you're using io.js, make sure to use n to install the latest version of node.js

% sudo n node latest
% node -v

And then do a global install of ttystudio

% sudo npm install -g ttystudio

This should take a minute, and may show a node-gyp error. But the install should work with Node, but not io as I said above.

When the install is done see if ttystudio is installed by typing

% ttystudio --help

And it'll print the man pages.

Next record a few lines on your terminal, and see how it works

% ttystudio output.gif

Type things into your terminal and hit ctrl-q when you're done recording.

I recorded the basic Hello World Koa.js example that I have in The Node.js Book

Mosh Mutt →

← How to write a markdown email with Nodemailer

Hi! I'm Ev Bogue. I serve at a restaurant in Fayetteville, NC.

I no longer use email. Please use Decent to contact me.

about | ev@evbogue.com | gitmx