Skip to content

Instantly share code, notes, and snippets.

@vmwarecode
Created March 8, 2017 05:06
Show Gist options
  • Save vmwarecode/f0ccefd78927762eab3a92f21c583772 to your computer and use it in GitHub Desktop.
Save vmwarecode/f0ccefd78927762eab3a92f21c583772 to your computer and use it in GitHub Desktop.
macOS - Common System Information Custom Attributes
## SIP-STATUS ##
csrutil status | awk '{print toupper($5)}' | sed 's/\.//g'
## OS-MINORBUILDVERSION ##
/usr/bin/sw_vers -buildVersion
## BATTERY-CYCLECOUNT ##
ioreg -r -c "AppleSmartBattery" | grep -w "CycleCount" | awk '{print $3}' | sed s/\"//g
## BATTERY-HEALTHSTATUS ##
result=`ioreg -r -c "AppleSmartBattery" | grep "PermanentFailureStatus" | awk '{print $3}' | sed s/\"//g`
if [ "$result" == "1" ]; then
result="FAIL"
elif [ "$result" == "0" ]; then
result="OK"
fi
echo $result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment