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 show with a time window reads back through the macOS log

macOS
~/tips/tip-macos-log-show-last

/usr/bin/log show --last 1h --style compact --predicate 'process == "softwareupdated"'

Look back through recent system log entries for one process instead of streaming.

Something went wrong ten minutes ago and you weren’t watching. log stream only shows what happens from now on; log show looks back.

Give it a time window with --last and narrow it down with a predicate, otherwise you drown in thousands of lines:

/usr/bin/log show --last 1h --style compact --predicate 'process == "softwareupdated"'

The man page says --last takes a number with s, m, h or d, and seconds when you leave the unit out. --style compact gives one short line per entry, which is easier to scan than the default.

Why would I type the full path? In zsh, which is the default shell on a Mac, log is also a shell builtin. Type plain log show ... and zsh answers with “too many arguments” instead of running Apple’s tool. /usr/bin/log skips the builtin.

Other handy windows are --last boot for everything since the last startup and --today. A predicate can also match the message itself, for example 'eventMessage CONTAINS "error"'.

Expect it to be slow on long windows. It reads a big store, so an hour with a tight predicate is quick, while a day without one can take a while and print a mountain of text. Some entries also show as private, which macOS does to hide personal data.

Further reading: log.1 man page

More macOS tips System Settings > Accessibility > Hover Text > When using the pointer A Smart Folder in Notes collects notes by tag, checklist or date Type # in a Mac note to tag it, then filter by tag in the sidebar tmutil isexcluded ~/Projects/app/node_modules Crop an image in Preview by dragging a frame and clicking Crop All macOS tips (99) All topics

Link