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.
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:
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…
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.
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.
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 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
User feedback