I am currently using a Mac Book Pro running on Mac Big Sur version 11.1 I'm looking to access the data that feeds the system preferences and activity monitor displays of past energy usage. Specifically, the battery data storage location or database source isn’t clear to me.

I'd like to have access to the battery consumption in percentage over the last 10 days see screenshot.

I know the equivalent is located in /var/lib/upower in linux but I can't seem to find it on mac. Please note that I am not looking for the current charge of the battery which we could get with system_profiler SPPowerDataType but the history of battery usage.

Specifically, my goal is to consume this data via a python script. Has anyone documented or reverse engineered how Apple stores this data?

  • 1
    Please don't cross-post to multiple SE sites. Pick one & stick to it. superuser.com/questions/1626891/… – Tetsujin Feb 18 at 9:24
  • Super question but it needed a big edit. Apple stores all this data via power metrics in the central logging database, so you will need someone to help with the database query - select sum(power) from table group by localized_day, for example. I doubt Apple just dumps this to a text or csv file, but let’s see what people have figured out of if Apple documented this as a non-private API. – bmike Feb 18 at 9:36

You must log in to answer this question.

Browse other questions tagged .