Mac Manager
Home Services Products Upgrades Specials Training About

Service & repairs
SSD upgrades
Windows on Mac
Training / tuition
Helpful hints
Automator Script



Software: Low Disk Space Script

Download AppleScript here


What does it do?

This is a simple AppleScript that tests for two things:

  • That there are no hard drives missing
  • That there is a certain (pre-defined) amount of available space

If one of these tests fail, it then automatically sends an email to one or more pre-defined addresses informing you of the problem.


What does it work on?

It should work on any version of macOS, however, I have only tested it on 10.3 - 10.8 clients and servers.


Why was it created?

macOS requires a certain amount of available space on its boot drive to function normally (at least 500MB, preferably over 5GB for safety). If it gets too low, the system begins to slow down to an eventual crawl, and can actually crash the computer/server altogether, requiring potentially hours/days of rebuilding.

I know because this happened to one of my Mac servers once. When the hard drive became full, and no-one realised until it was too late, it crashed completely. Even after clearing plenty of space, it still wouldn't start up any longer - it took 2 days to rebuild.


Who is it useful for?

Anyone who needs something automated to check their available disk space for them. Especially useful for those with remote computers/servers that can't easily check this regularly. Also handy for those that want to check when their backup drive is close to filling up, or that the backup drive is even present so the backup can occur.


How do I customise it?

By default, this script will check for one hard drive, and that this hard drive has at least 10% of available space remaining. To customise this for any number of hard drives, and a minimum percent of your choosing, open the script and modify the first 3 values under "change these settings" to whatever you like.

  • To set how many drives (internal and external) you have connected , change the property next to "set expectedNumberOfHardDisks to" from the default of 1 to how many you have
  • To set the minimum amount of free space you'd like to check for, change the property next to "set minimumFreeSpacePercentage to" from the default of 10 to whatever you'd like
  • And most importantly, to tell it what email address(es) to send the error report to, change the property next to "set sendToAddresses to" to your email address. Be sure to keep all the relevant code such as { " , " } otherwise the script may not work

Once you've finished customising the script, depending what version of OS X you have, select Save As or Export from the File menu, choose Application from the File Format drop-down menu and save it to a safe place (such as Documents or Library) so it won't accidentally be moved or deleted. This application file is what will be used in the instructions below, and the file you downloaded and modified, "Low Disk Space Script" can be either trashed or kept for future reference if you wish.


How can I set it so that it checks automatically?

I'm sure there are programs that can run AppleScripts and Applications periodically, but I find it just as easy to set a simple appointment every hour/day/week/whatever in iCal (or Calendar as it is now known in Mountain Lion), and tell it to run this application.

To do this in iCal/Calendar, use the following instructions:

    1. Create an appointment
    2. Name it
    3. Select how often you'd like this to repeat (every day for example)
    4. Select "Open File" from the alarm/alert menu
    5. Select "Other" from the menu below this
    6. Navigate to the location of your application file created above
    7. Click Select
    8. That's it!

Note - iCal/Calendar does not have to be open for this to occur.


How much is it?



Who made it?

Matthew Lindfield Seager.
Special thanks to Stuart and Andrew for updating it.


The usual disclaimer

This software is 'use at your own risk.' While every effort has been made to ensure the safety of this software and its contents, we cannot be held liable for any problem, damage or deletion that is caused by the use of this script.



If you have any questions, please email us.



Phone: 1300 650 126

Mobile: 0407 026 037

Email: click here


Copyright © 2023 Mac Manager