My MacBook Air suddenly shut down today, is there an easy way to find the associated log entry? My old 2012 MacBook air suddenly shut down. I had the battery recently replaced by a non-Apple shop since Apple has already obsoleted this model.

The battery was somewhere between 60% and 80% when this happened. I wasn't doing anything particularly power-consuming, WiFi was on but I was just editing some slides (no active browsing or movie-watching).

I plugged the power in and restarted. The date was reset to something in 2018 and the time was wrong. I connected to the internet and let it auto-reset.

I've had this new battery a month or two and it's worked fine until today; I can work offline for ~5 hours and still have ~30% charge left. 

Question: I've never looked closely at the console reports before so I don't know how to search for a sudden shut down, possibly due to loss of power. I do know that I had to reset the clock after starting again. How can I zero in on "something bad happened" reports?



Battery Information:

  Model Information:
  Serial Number:    W0137xxxxxxxx
  Manufacturer: SMP
  Device Name:  BQ20Z451
  Pack Lot Code:    0
  PCB Lot Code: 0
  Firmware Version: 201
  Hardware Revision:    000a
  Cell Revision:    158
  Charge Information:
  Charge Remaining (mAh):   7596
  Fully Charged:    No
  Charging: Yes
  Full Charge Capacity (mAh):   7845
  Health Information:
  Cycle Count:  31
  Condition:    Normal
  Battery Installed:    Yes
  Amperage (mA):    333
  Voltage (mV): 8362
You can get the previous shutdown cause from the log history.

In macOS Sierra and later with unified logging:


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



Earlier than macOS Sierra, filer system.log for some recent results:

grep "Previous shutdown cause" /var/log/system.log


Then look up the code on this table I maintain: Previous Shutdown Causes Explained