Capture from the command line

Use glimmer capture to take screenshots of a window, a display, a rectangle or the whole desktop from Terminal and scripts.

glimmer capture (--region | --rect X,Y,W,H | --window [selectors] | --display D | --screen) [-o FILE] [options]

What to capture#

OptionCaptures
--regionA region you drag on screen. Needs someone at the Mac.
--rect X,Y,W,HA rectangle in points, from the top-left of the main display.
--windowA window. See Choosing a window. Any window selector implies --window.
--display DOne display. See Choosing a display.
--screenEvery display, as one image. For the main display alone, use --display 1.

Options#

OptionMeaning
-o FILEWrite to a file. -o - is standard output.
--format png|jpeg|heic|tiffDefault: from the -o extension, else PNG.
--cursorInclude the pointer.
--no-shadowLeave out a window’s shadow.
--no-menu-barLeave out the menu bar.
--delay SECONDSWait first, up to 60.
--max-dimension PIXELSScale down so the long edge is at most this (at least 16).
--saveAlso keep the capture in the Library.

Glimmer won’t write image bytes to a terminal. Without -o, redirect or pipe the output.

glimmer capture --bundle-id com.apple.Safari -o safari.png
glimmer capture --display "LG UltraFine" --format jpeg > desk.jpg
glimmer capture --screen -o desktop.png

Choosing a window#

With no selector, the frontmost window is captured. Selectors combine; the frontmost match wins.

SelectorMatches
--bundle-id IDThe app’s bundle ID, any case. The most reliable.
--app NAMEThe app’s name, exact, any case.
--title REGEXA regular expression found anywhere in the window title.
--window-id NA window ID from glimmer windows.
--index NThe Nth match, front to back, from 1.

glimmer windows lists what can be captured. Error messages never print other windows’ titles.

Choosing a display#

--display takes a display’s UUID (stable across restarts), its name (or a unique part of it) or its number. Number 1 is the main display, then left to right and top to bottom. Numbers change when you rearrange displays, so use the UUID in scripts. glimmer displays lists them.

Redaction#

Captures pass through your redaction settings before they leave Glimmer. If something needs a person to review it first, the command fails with exit code 14 and no image.

Next#

Something missing or unclear? Write to [email protected].

↑ ↓ to move, Enter to open, Esc to close