Luke Oliff.

TIL: Recording Terminal Sessions With script and scriptreplay

·TIL·1 min read·Luke Oliff

When you need to show someone what happened in a terminal session but they are not looking over your shoulder, script and scriptreplay are the built-in answer.

script session.log
Script started, output file is session.log
$ curl -s https://api.example.com/v1/status
{"ok":true}
$ exit
Script done.

Play it back with scriptreplay.

scriptreplay session.log

The timing file keeps the original pacing. Real keystrokes, real pauses. For demo recordings or bug reproduction steps, this is cleaner than a screen recording and produces a text file you can diff.

Does this work on macOS?

Yes. script and scriptreplay are part of the BSD subsystem, built into macOS and every Linux distribution.