brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: screencapture -V records a screen video for a set time from the Mac terminal

Terminal
~/tips/tip-terminal-screencapture-video

screencapture -V 20 -k ~/Desktop/demo.mov

Records the screen for a fixed number of seconds without opening any app.

screencapture is known for screenshots, but it records video as well, and you can give it a time limit.

-v starts a recording you stop yourself. -V takes a number of seconds and stops on its own:

screencapture -V 20 -k ~/Desktop/demo.mov

That records 20 seconds of the screen to a QuickTime movie. -k draws a circle on every click, which helps when you show someone where to press. -g adds audio from the default microphone.

Because it is a command, it fits in a script. I like it for capturing a bug that only shows up when something else runs:

screencapture -V 15 ~/Desktop/bug.mov &
./reproduce-the-bug.sh

The & runs the recording in the background while the script does its thing.

The first run triggers the Screen Recording permission for your terminal app, under Privacy & Security. Until you allow it, recordings may show little more than the desktop background. The man page itself admits the tool is not very well documented, and options shift a little between macOS versions, so run screencapture -h to see what your version supports. Movies from a Retina screen get large quickly, so keep them short.

Further reading: screencapture man page (macOS)

More Terminal tips ioreg -rn AppleSmartBattery | grep CycleCount Terminal can save your windows and tabs as a window group Export a Terminal profile to a .terminal file and import it on another Mac mc hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000029}]}' All Terminal tips (116) All topics

Link