How to Safely Delete the Mac ‘SleepImage’ File (Reclaim Gigabytes of SSD Space)

When you close the lid on your MacBook, it enters a low-power “Sleep” state. However, to ensure you don’t lose any data if the battery completely dies while the lid is closed, macOS also performs a “Safe Sleep.” It copies the entire contents of your active RAM (memory) and writes it into a massive hidden file on your SSD called the sleepimage.

If your MacBook has 16 GB or 32 GB of RAM, this hidden sleepimage file will permanently consume exactly 16 GB or 32 GB of your precious SSD storage space, even when your Mac is fully awake. If you are desperately low on storage and never let your Mac’s battery die while sleeping, you can safely delete this file and prevent macOS from ever creating it again.

How to Safely Delete the Mac SleepImage File

You must use the Terminal to change your Mac’s hibernation mode and delete the hidden image.

  1. Open the Finder, go to Applications, open the Utilities folder, and double-click Terminal.
  2. First, you must disable the “Safe Sleep” hibernation feature. This tells your Mac to only sleep in RAM, without writing to the SSD. Type the following command and press Enter: sudo pmset -a hibernatemode 0
  3. Because this modifies power management, you will be prompted for your administrator password. Type it and press Enter.
  4. Now that the feature is disabled, you can safely delete the massive file. Type this command and press Enter: sudo rm /private/var/vm/sleepimage

You have now instantly reclaimed gigabytes of SSD space. However, macOS is stubborn and might try to recreate an empty version of this file in the future. To completely lock the operating system out of regenerating the file, run this final command to create an empty, un-writable dummy file in its place:

  1. sudo touch /private/var/vm/sleepimage
  2. sudo chflags uchg /private/var/vm/sleepimage

Your Mac will now sleep normally (and wake up instantly) using only RAM, and your SSD space is permanently protected from massive hibernation files.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.