How do I write to the device Console log from the command line?

Solution 1:

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:

  • https://developer.apple.com/documentation/os/logging
  • https://eclecticlight.co/2017/10/10/inside-the-macos-log-logd-and-the-files-that-it-manages/
  • http://krypted.com/mac-os-x/logs-logging-logger-oh/