MacOS doesn't follow Linux style mapping of files to system information. But we do have useful CLI commands.
The main command I found for this is sysctl and sysctl -a gives all system information.
Specific commands
// total memory size
$ sysctl hw.memsize
// cpu info
$ sysctl hw.ncpu
$ sysctl vm.loadavg
vm.loadavg: { 1.31 1.85 2.00 }
RAM usage can be parsed using top -l 1. It pretty much gives us everything in single snapshot, but I am not sure about regex.
Also top commands seems to be slow, vm_stat is better option for RAM. The values will need to be computed.
Also Mac has a concept of Wired Memory. Need to read a bit about it.
Battery info can be fetched using pmset -g batt
References
MacOS doesn't follow Linux style mapping of files to system information. But we do have useful CLI commands.
The main command I found for this is
sysctlandsysctl -agives all system information.Specific commands
// total memory size $ sysctl hw.memsize // cpu info $ sysctl hw.ncpu $ sysctl vm.loadavg vm.loadavg: { 1.31 1.85 2.00 }RAM usage can be parsed using
top -l 1. It pretty much gives us everything in single snapshot, but I am not sure about regex.Also top commands seems to be slow,
vm_statis better option for RAM. The values will need to be computed.Battery info can be fetched using
pmset -g battReferences