132

After upgrading to macOS Sierra, I'm getting the notification that "Your disk is almost full. Save space by optimizing storage.":

macOS notification

The options appear to be to store my files in iCloud, automatically delete files, or manually delete files:

enter image description here

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?

Mike Boers
  • 1,463

4 Answers4

129

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.

malhal
  • 2,092
  • 1
    note that the 'defaults' solution appears to be tied to the account running the command. i initially ran it with 'sudo' and that didn't work. without the sudo, all good. – Ben McIntyre Sep 24 '17 at 20:23
  • 15
    osX is bloody pathetic that you have to do use terminal to turn these things off. – Jamie Hutber May 15 '18 at 11:25
  • 19
    Operation not permitted while System Integrity Protection is engaged – Raptor May 31 '18 at 01:42
  • 2
    While even using with sudo I'm getting /System/Library/LaunchAgents/com.apple.diskspaced.plist: Could not find specified service. – Deilan Jul 21 '18 at 17:15
  • 25
    "a possible bug causes the alert to be shown every day" Mine pops up every 5 f**ing seconds. This answer really helped. – Aloha Aug 18 '18 at 01:40
  • 4
    Yeah with Mojave this alert is popping up literally every 20 seconds for me, not daily. Maybe if Xcode would stop automatically installing 20 gb worth of simulator files with every update, this wouldn't be an issue. Alas... @malhal I have set the default for min space to a lower value. Is there a way to see which defaults you've manually changed, or should I keep track of something like this myself? – Jake T. Nov 03 '18 at 21:49
  • I applied this setting on Mojave, set min space to be lower and increased warning interval but keep having same warning even after reboot. – zcahfg2 Nov 04 '18 at 19:27
  • 8
    We need an updated answer for Mojave – zcahfg2 Nov 04 '18 at 19:29
  • Once you've done this, how can you get to the program in the screenshot above? – Samie Bee Nov 24 '18 at 06:19
  • 1
    Works for Mojave? – chengsam Nov 27 '18 at 04:41
  • Doesn't work for me-- /System/Library/LaunchAgents/com.apple.diskspaced.plist: Could not find specified service – temporary_user_name May 08 '19 at 00:09
  • 1
    Raptor, you can disable System Integrity Protection, but it leaves the machine more vulnerable to malware. You can instead just change the diskspaced minimum disk space threshold with defaults write com.apple.diskspaced minFreeSpace [GB value]. Or you can kill the daemon on every restart with killall diskspaced. You could even put this killall command in a startup script. Personally, I would do these things rather than disabling SIP. – Kallaste Jun 25 '19 at 04:38
  • @JamieHutber Meh, I think it would be pathetic if you had to use a GUI. The unix base is literally the reason to use OSX. – fferen Oct 10 '19 at 00:32
  • 1
    What's the difference between the launchctl unload -w method and the launchctl stop method? And how can the default settings be re-instated (just in case)? – Mentalist Feb 21 '20 at 18:53
  • 1
    @Raptor https://www.howtogeek.com/230424/how-to-disable-system-integrity-protection-on-a-mac-and-why-you-shouldnt/ But see kenorb's answer first. launchctl list com.apple.diskspaced to find PID, then kill -KILL PID. Although none of the other kill commands worked in High Sierra, this one works. – Magne May 10 '20 at 16:11
  • None of these worked on High Sierra... messages are still here after restart. – MicroMachine Jun 17 '20 at 20:35
44

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
kenorb
  • 12,695
  • 2
    Running those commands as of Mojave doesn't seem to have any effect. – Jonathan Allard Nov 02 '18 at 19:58
  • @kenorb, so what does that last grep command do, for macOS mojave I get a different output (see here), and I'm trying to use that to disable the popup on Mojave. Any ideas how that could be done? – JoeVictor Nov 14 '18 at 20:12
  • 2
    Still running Sierra on a MBA 2012. That nag screen was annoying, and put me in a position to not want to buy another Macbook.

    killall -STOP diskspaced fixed this for me... Thanks

    – mrSidX Sep 02 '19 at 22:45
  • 1
    launchctl list com.apple.diskspaced to find PID, then kill -KILL PID. Although none of the other kill commands worked in High Sierra, this one works. – Magne May 10 '20 at 16:09
  • @Magne On High Sierra I am getting "arguments must be process or job IDs" – MicroMachine Jun 17 '20 at 20:27
  • @MicroMachine maybe you didn't replace PID in the kill command with the PID number you found using the launchctl command? – Magne Jun 17 '20 at 22:27
11

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).

  • 9
    There's a system process called deleted that purges caches and whenever it does, it sends a CACHE_DELETE_PURGEABLE_UPDATED distributed notification to all apps. Whenever that notification is sent, the "Your disk is almost full" notification shows up, so I think it's a bug in some app that's listening for that distributed notification. – inket Jan 27 '17 at 02:12
  • 1
    @inket How does one watch these notifications? – Mike Boers Mar 11 '17 at 13:56
  • 4
    Agreed.I am on Mojave 10.14, none of these suggesting did anything. This is really annoying. – vknyvz Nov 09 '18 at 20:53
3

Turning on Do Not Disturb mode for notifications will silence the "Your disk is almost full" notifications. There is a downside as this will silence all notifications.

notification sidebar with do not disturb turned on, it says "Will turn off tomorrow" underneath

This will not help with the underlying issue of your disk being too full if it is in fact too full. Additionally, you may need to turn Do Not Disturb on again. It looks like it may be possible to get it remain on for all but about one minute of the day, but I'm not sure the developers intended Do Not Disturb to be used continually.

notifications preference pane set to have Do Not Disturb from 12AM to 11:59PM

dwightk
  • 7,619
  • 14
  • 47
  • 70