Skip to content

Instantly share code, notes, and snippets.

@euforic
Created December 10, 2012 18:32
Show Gist options
  • Save euforic/4252348 to your computer and use it in GitHub Desktop.
Save euforic/4252348 to your computer and use it in GitHub Desktop.
Battery Health and Cycles
osascript -e 'set a to do shell script "ioreg -w0 -l | grep Capacity"' -e "set h to word 5 of a" -e "set z to word 33 of a" -e "set b to word 38 of a" -e "set c to 1000 * b / z" -e "set d to round c" -e "set f to d / 10" -e "set q to 1000 * h / b" -e "set w to round q" -e "set j to w / 10" -e '"Battery Health: " & j &"%"' | iconv -f utf-8 -t ucs-2-internal;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment