0

I want to use automator or terminal to fetch data from the mac console app.

In particular:

If you search for "sleepwake" in the console app › tab "Mac Analytics Data", you get the timestamps when you woke up the mac from sleep mode.

I want to get those timestamps (e.g. the last one) by some sort of automation.

Any idea?

1 Answer 1

0

You can use the a command line call to sysctl to get the last sleep and wake times:

sysctl kern.sleeptime kern.waketime

In my case, the output was:

kern.sleeptime: { sec = 1596154703, usec = 743388 } Fri Jul 31 01:18:23 2020
kern.waketime: { sec = 1596157070, usec = 25 } Fri Jul 31 01:57:50 2020
3
  • thank you, this was exactly what I need. I also found kern.boottime but no command for the shutdown or user login time although they can be found in the console.app. Do you know the commands or the documentation for the kern-command? Commented Aug 6, 2020 at 9:35
  • Are you looking for a list of available identifiers you can retrieve with sysctl ? The ones that are in the kern array can be listed like so: sysctl -N kern (or without the -N flag to print the values as well).
    – CJK
    Commented Aug 8, 2020 at 6:40
  • thank you, that was what I needed Commented Aug 8, 2020 at 11:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .