Last active
August 5, 2020 17:41
-
-
Save trvswgnr/e9f317c2dc4ab923b0fc7202cb989b93 to your computer and use it in GitHub Desktop.
Set MacOS low storage notification limit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [[ -z $1 ]]; then | |
echo 'Please set a disk space limit to trigger the low disk space warning' | |
exit 1; | |
else | |
LIMIT=$1 | |
fi | |
defaults write com.apple.diskspaced minFreeSpace $LIMIT | |
echo "Low disk space warning limit set to $LIMIT" | |
if [[ $(csrutil status) == "System Integrity Protection status: enabled." ]]; then | |
killall diskspaced | |
echo 'System Integrity Protection is enabled. Killed diskspaced daemon to suppress warning, restart for new limit to take effect.' | |
else | |
launchctl unload -w /System/Library/LaunchAgents/com.apple.diskspaced.plist | |
launchctl load -w /System/Library/LaunchAgents/com.apple.diskspaced.plist | |
echo 'Restarted diskspaced daemon, new limit should take effect immediately.' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment