macOS – How to Write to Device Console Log from Command Line

command lineconsolehigh sierramacosterminal

How do I write to the log for my "Device" in the Console app from the command line. I've tried

syslog -s -k Facility com.apple.console \
             Level Alert \
             Sender SomeSender \
             Message "some message"

and

syslog -s -l error "message to send"

but don't see anything.

Best Answer

Apple has a new logging system so the old tail and syslog commands are deprecated. To start down the new unified log path, open two windows the first will just stream the logs (and they will fly by quickly normally)

log stream

Then to emit a log:

logger -p user.error "my new alert"

More good links: