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: log stream --predicate watches the Mac log live for one app

Terminal
~/tips/tip-macos-log-stream-predicate

log stream --predicate 'process == "Finder"' --style compact

Streams the macOS unified log live, filtered to one process or subsystem.

Console is fine for browsing. When an app misbehaves right now, I would rather watch its messages scroll by in Terminal.

The unified log has a live mode, and a predicate keeps it from drowning you:

log stream --predicate 'process == "Finder"' --style compact

Press Control-C to stop. process is the name of the program that sent the message. The man page also shows filtering on a subsystem, for example subsystem == "com.example.my_subsystem", and the list of supported keys includes eventMessage, sender, category and messageType. Conditions can be combined with and and or. To see only errors from one process:

log stream --predicate 'process == "Finder" and messageType == error'

--style accepts default, compact, json, ndjson and syslog. Compact is the one I find easiest to read. With --timeout 5m the stream ends by itself after five minutes.

By default --level is default. Pass info or debug to also see those lower levels, because the level is a hierarchy and debug includes the other two. For something that already happened, log show takes the same --predicate plus --last 10m.

The caveat: the output can contain names of files, hosts and accounts, so look it over before you share it.

Further reading: log man page

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