How can I force a Mac laptop to shutdown when the battery is below 25%? It is common wisdom that Lithium-Ion batteries should not be left with 0% charge.

However, some users might not be aware of this common wisdom, or simply refuse to concern themselves about proper battery care. For example, an end-user may drain the battery to 0%, then put the computer away without putting it back on the charge. This rapidly diminishes the life of the battery.

Is there any app or setting that will force the computer to turn off when the battery charge is around 25%, to ensure that a healthy reserve is available and damage to the battery is avoided?
I haven't tested this, although something such as this should work:

property lowBattery : 25

on idle
    set battStatus to do shell script "pmset -g ps"
    if battStatus contains "InternalBattery" then
        set {TID, text item delimiters} to {text item delimiters, ";"}
        set battStatus to text items of battStatus
        set text item delimiters to space
        set battStatus to text 1 thru -2 of last text item of item 1 of battStatus as integer
        set text item delimiters to TID
        -- Shutdown if battery is less than 25%
        if battStatus &lt; lowBattery then tell application "loginwindow" to «event aevtrsdn»
    end if
    return 60
end idle


In AppleScript editor save it as an Application using Stay open run handler, then add it to your Login Items under System Preferences &gt; Users &amp; Groups