MacOS – the files for System Information

macossystem-information

I'm just curious if anyone knows where I can find the files that feed the data into the System Information Application (ATA, Audio, etc).

I am interested in writing a program that sends an email every time the battery cycle count increases.

Thanks.

Best Answer

System Information is a GUI for the CLI system_profiler. It's read directly from whatever system_profiler spits out. All the work is already done for you (system_profiler reads from many different files and executables):

!Just saw an answer posted. See @XAleXOwnZX for the exact command.

To compile that into a script within Terminal, enter text as follows. Return is supported for newlines after cat command.

njboot$ cat > cycle

#! /bin/bash

#Output is current cycle count of the battery

system_profiler SPPowerDataType | grep "Cycle Count" | awk '{print $3}'

  • Now, you have the script. Press Control+D within terminal for a carriage return:

  • Make executable:

njboot$ chmod +x cycle

  • Test:

njboot$ ./cycle 64

  • Move into your local bin, if it's included in your shell path. The file currently resides in your top user directory ~/

Optional:

njboot$ mv cycle ~/bin/

  • Now it runs directly!

njboot$ cycle 64

Addendum: Again, credit to XAleXOwnZX for the exact command

njboot$ cat > cycle
#! /bin/bash

#Cycle Count of Battery

system_profiler SPPowerDataType | grep "Cycle Count" | awk '{print $3}'    
njboot$ chmod +x cycle
njboot$ ./cycle
64
njboot$ mv cycle ~/bin/
njboot$ cycle
64