Skip to content

Instantly share code, notes, and snippets.

@ADTC
Last active September 21, 2026 01:49
Show Gist options
  • Select an option

  • Save ADTC/0802eae7ff87110048a14632b9d5f807 to your computer and use it in GitHub Desktop.

Select an option

Save ADTC/0802eae7ff87110048a14632b9d5f807 to your computer and use it in GitHub Desktop.
Apple MacBook macOS Critical Battery Warning at 5% or less (`/usr/local/bin/*`)

Update (Sep 2026):

I had since improved the scripts by adding another one to also ping me if the AC charger was disconnected (useful to know if it accidentally fell off or lost connection to electricity, and nice confirmation if I deliberately removed it), and this month I upgraded the warning system to combine the two into a single LaunchAgent triggered script, which I have now pushed to a GitHub repo.

The original scripts from this Gist are now a historical reference in the root commit. I don't recommend them. Instead, use the launch agent at the latest commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment