6

script is a great tool to record all activities in terminal(http://linuxers.org/article/script-command-line-tool-recordsave-your-terminal-activity). The builtin script executable on Mac is not able to record the timing of the typescript. I am trying to compile the package util-linux (https://github.com/karelzak/util-linux, which contains linux version script) but without success:

$ make
make  all-recursive
Making all in po
make[2]: Nothing to be done for `all'.
  CC       lib/libcommon_la-strutils.lo
In file included from lib/strutils.c:16:
./include/strutils.h:77: error: conflicting types for 'strmode'
/usr/include/string.h:168: error: previous declaration of 'strmode' was here
lib/strutils.c:351: error: conflicting types for 'strmode'
/usr/include/string.h:168: error: previous declaration of 'strmode' was here
lib/strutils.c: In function 'size_to_human_string':
lib/strutils.c:442: warning: format '%jd' expects type 'intmax_t', but argument 8 has type 'uint64_t'
make[2]: *** [lib/libcommon_la-strutils.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Is there any compiled excutable out there for Mac?

4 Answers 4

11

The scriptversion on OS X has the -r option, which will record all input, output and timings in a single file. it can be replayed using the -p option.


Instructions:

START:

$ script -r

Start typing commands...

STOP:

$ exit

REPLAY:

$ script -p typescript

7

ttyrec includes a fix for the timing issue and, for all intents and purposes, serves the same function (described as a derivative of script in its manpage). It's available via brew (brew install ttyrec) or MacPorts (sudo port install ttyrec).

  • ttyrec: Official website
  • shelr.tv: YouTube for terminal recordings
  • ttygif: Converts terminal recordings to animated GIFs
1
  • OSX High Sierra: Error: Port ttyrec not found and the brew version fails Out of pty's :( Commented Dec 14, 2017 at 17:36
3

Just in case anyone else stumbles here trying to figure out how to replay scripts on MacOS that were recorded with the util-linux version of script, you might find this useful:

https://bitbucket.org/rewbs/docker-scriptreplay

It's just a really simple Alpine Linux based Docker image that enables you to run scriptreplay on MacOS (via Docker). I found this useful to ensure a wide audience of Mac users could replay scripts recorded on Linux servers using standard tools. Hope someone else finds this useful! :)

0

I am trying to compile the package util-linux (https://github.com/karelzak/util-linux, which contains linux version script) but without success:

The error message from the compiler on the 'incompatible types' is the clue to why it failed. There's a conflict between the declarations in the system header files resident on OS X (BSD-based) and those in the include files from util-linux(GNU/Linux based).

Not the answer you're looking for? Browse other questions tagged or ask your own question.