MacOS – How to get shutdown codes using terminal in macOS

macosshutdownterminal

How can I use Terminal to get my shutdown codes, going back to the weekend?

I'm on Mojave 10.14.6

Best Answer

You can just enter the following command into Terminal:

log show --predicate 'eventMessage contains "Previous shutdown cause"' --last 168h

The 168h refers to 168 hours, which I've used so that the command goes back a week (since you want to capture the weekend).

However, you can change the 168 to another value if you like.