Best Reviews logo
Best Reviews may receive compensation for its content through paid collaborations. See how we sustain our work & review products.
How to Delete Sleepimage on macOS

How to Delete Sleepimage on macOS

By István F.István F. Verified by Adam B.Adam B. Last updated: January 13, 2025 (1)
Table of contents

One of the best features of using a portable computer is that all the documents and apps you left open are available immediately after opening the MacBook’s lid. But did you know that this feature comes with a cost, and is in fact eating into your limited disk space?

If you have been keeping an eye on disk usage by using a Mac optimization app or other such application, you may have noticed a file named ‘sleepimage’ claiming gigabytes of your storage. Removing it will save you a lot of space, which is why advanced Mac users like to delete this space hog.

What is Sleepimage?

Ever since it was introduced by MacBook models in late 2005, Apple has used a neat feature called safe sleep. This feature is similar to what is known as ‘hibernation mode’ in other operating systems. With safe sleep on, when the Mac ‘falls asleep’ the contents of its main memory – open apps, desktop settings, work in progress, etc. – are all saved and written to the disk. In other words, before macOS turns off all power to the system’s RAM, it makes an image of the system’s current state, writes it to disk, and uses the sleepimage file that it creates to restore the system to the same state that the user left it in. This way your work is saved if, for some reason, the Mac completely runs out of power.

There are two situations where a Mac enters safe sleep:

  1. The MacBook’s battery is completely drained while the computer is asleep, and the computer shuts down. When once again connected to a power source and turned on, you’ll find the computer in the state you left it.
  2. After four hours of being connected to a power source, the Mac will enter safe sleep mode if it doesn’t detect any network activity or activity from connected devices.

Considering that macOS will write the contents of its active memory to disk, the size of the sleepimage – which you’ll find under /private/var/vm/ – will match the amount of RAM you have installed on your computer. In other words, if you have 4GB of RAM, then the sleepimage size will also be 4GB, if the MacBook has 16GB of RAM installed then sleepimage will be 16GB, and so on…

How to check the current size of the Sleepimage

You can check the current size of the sleepimage by typing the following command into Terminal:

ls -lh /private/var/vm/sleepimage

You’ll see something like this:

-rw——T 1 root wheel 1.0G Dec 3 08:55 /private/var/vm/sleepimage

From this string of text, find the data that precedes the date and this will be the number that represents the size of the sleepimage. In this example the “1.0G” is the file size, meaning 1GB of data, but it doesn’t reflect the amount of RAM the test machine has (8GB). With macOS High Sierra Apple has apparently changed the way the operating system handles virtual memory, hence the difference in size between sleepimage and the amount of RAM installed in the machine.

How to remove the Sleepimage file

In macOS versions prior to 10.13 High Sierra the sleepimage can be removed easily, just type in a command into Terminal:

sudo rm /private/var/vm/sleepimage

At this point you’ll be prompted for the admin password. Once done the file will be erased.

With macOS High Sierra, however, the sleepimage file was moved under the System Integrity Protection or SIP, which limits the system functions of the root user. In this situation the above command will trigger an error or a reply from Terminal that says “operation not permitted”. This sleepimage deletion can still be completed, but you will need to first disable SIP. To do that, follow our guide and then once again follow the steps described above.

How to disable Sleepimage

Unfortunately, following this process only saves this space once since it won’t prevent macOS from creating another sleepmage file next time the Mac goes to sleep. This is a measure that Apple has taken to prevent loss of data, but if you trust your ability to save periodically then this protective layer can be disabled by setting the hibernate mode to 0.

If you’re happy with the risks to your data then enter the following command into Terminal:

sudo pmset -a hibernatemode 0

At this point you’ll need to enter in the admin password to complete the action. By doing so, your Mac will wake up faster but we can’t recommend this option since your data will be lost if the battery power runs out since this setting will stop macOS from writing the content of its memory to disk.


Best Mac optimization software of 2025

Editor's choice
CleanMyMac X logo
Editor's rating:
(4.5)
User-friendly dashboard
Effective scanning and cleaning options
Various maintenance tools
Built-in malware remover
All-around protection
MacKeeper logo
Editor's rating:
(4)
Personalized remote assistance
Unique optimization tools
Anti-theft tracking
Built-in antivirus
Beginners
MacBooster logo
Editor's rating:
(3.5)
Fast scanning
User-friendly UI
Virus and malware scan
Great cleaning features
Businesses
CCleaner for Mac logo
Editor's rating:
(4)
Fast scans and cleaning
Full customization
Extensive free version
Affordable

User feedback

    Tjarko Holtjer
    I've created sleepimage as a Folder/Directory/Map... Now it's not being created with Mojave again... Hibermode 0 is still creating the new image on my SSD!
    No comments with that rating.

 Leave a reply

Your email address will not be published. Required fields are marked *


Best Reviews

Best Reviews may receive compensation for its content through paid collaborations and/or affiliate links. Learn more about how we sustain our work and review products.

©2012-2025 Best Reviews, a clovio brand – All rights reserved
Privacy policy · Cookie policy · Terms of use · Partnerships · Contact us