Silencing "Your disk is almost full" notification
After upgrading to macOS Sierra, I'm getting the notification that "Your disk is almost full. Save space by optimizing storage.":
The options appear to be to store my files in iCloud, automatically delete files, or manually delete files:
My problem/irritation is that I have 80GB free of my 440GB volume.
The question: is there a way to silence this notification in a (semi-)permanent fashion, or to change the threshold it uses for the notification?
The solution to disabling the "almost full" and "full" notification is to disable the daemon responsible for it:
launchctl unload -w /System/Library/LaunchAgents/com.apple.diskspaced.plist
or
launchctl stop com.apple.diskspaced
Alternatively, if you only want to prevent the "almost full" from appearing so often then you can lower the GB threshold via:
minFreeSpace (int) - minimal free size in GB. Default: 20
The default 20GB is too high for small SSDs and a possible bug causes the alert to be shown every day rather than just once, so as a workaround you can lower the free space before the alert appears, e.g. to 10GB:
defaults write com.apple.diskspaced minFreeSpace 10
The daemon only reads its prefs on startup so you need to restart it if you have system integrity turned off:
launchctl unload -w /System/Library/LaunchAgents/com.apple.diskspaced.plist
launchctl load -w /System/Library/LaunchAgents/com.apple.diskspaced.plist
Otherwise kill it:
killall diskspaced
In case you are interested in the other preferences for these disk alerts you can view some of them using the help param:
/System/Library/PrivateFrameworks/StorageManagement.framework/Versions/A/Resources/diskspaced help
---
Domain: com.apple.diskspaced
Supported keys:
debugLog (BOOL) - log additional debug information. Default: NO
checkAllVolumes (BOOL) - check all volumes. Default: NO
minDiskSize (int) - minimal disk size in GB. Default: 128
minFreeSpace (int) - minimal free size in GB. Default: 20
minPurgeableSpace (int) - minimal purgeabe space size in GB. Default: 20
---
Commands: removeAllNotifications - Removes all scheduled and delivered user notificiations.
And here are a couple of hidden ones:
warningInterval (integer default 0)
lastWarningDate (string e.g. 2017-05-05 16:48:29 +0000)
I didn't look too closely at but it is possible setting the last warning date to a date in the future would also prevent the alert displaying.
macOS Mojave
See: How to access a launch daemon's values/ system defaults value
macOS Sierra
On Sierra this command didn't work for me:
launchctl unload -w /System/Library/LaunchAgents/com.apple.diskspaced.plist
due to System Integrity Protection engaged, so to stop the diskspaced
service, run:
launchctl stop com.apple.diskspaced
Note: Use start
to start again or list
to see the details (e.g. its PID
).
If the service is restarting after a while, try the following command to stop it:
killall -STOP diskspaced
Changing warning level and interval
To change the user's default settings, here are some example commands:
defaults write com.apple.diskspaced freeSpaceWarningLevel 1
defaults write com.apple.diskspaced warningInterval 3600
defaults write com.apple.diskspaced debugLog 1
defaults write com.apple.diskspaced checkAllVolumes 0
Then restart the service:
launchctl stop com.apple.diskspaced && launchctl start com.apple.diskspaced
To see the loaded settings, run diskspaced
, e.g.:
$(find /System/Library/PrivateFrameworks -name diskspaced -print -quit)
2017-08-04 18:32:27.943 diskspaced[92401:12312556] FreeSpaceWarningLevel: 1
2017-08-04 18:32:27.943 diskspaced[92401:12312556] WarningInterval: 3600
2017-08-04 18:32:27.943 diskspaced[92401:12312556] Check All Volumes: NO
Notes
I believe parameters mentioned by @malhal no longer exist. Here is a simple command to test this:
$ grep -A6 debugLog <(strings $(find /System/Library/PrivateFrameworks -name diskspaced -print -quit))
debugLog
freeSpaceWarningLevel
FreeSpaceWarningLevel: %ld
warningInterval
WarningInterval: %ld
checkAllVolumes
Check All Volumes: %@
Troubleshooting
Check the logs by this command for any warnings:
grep com.apple.diskspaced /var/log/system.log
I think this notification is a bug.
I have 760GB free on my drive (a 1TB drive) and still get this same notification every morning since upgrading to Sierra.
I enabled Optimize Storage (but not Store in iCloud).