I am not able to delete the sleep image. It currently runs on macOS Catalina. As root, when I try to delete the sleep image I get the message "Operation not permitted".
Can someone help answer how do I delete the sleep image?
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
TL;DR Under macOS Catalina, to remove the sleepimage file using Terminal while booted normally to your Desktop, use the following command:
sudo pmset hibernatemode 0
Tested under a macOS Catalina (10.15.6) system, without FileVault, the following was all that was necessary to remove the sleepimage file, typically located at:
Note that this was done in a normal mode boot and booting to macOS Recovery and disabling System Integrity Protection was not needed. Even if booted to macOS Recovery, one does not need to disable System Integrity Protection in order to delete the sleepimage file from there.
Booted to my normal Desktop, in Terminal I ran the following commands to show it can be done as advertised:
~ % pmset -g | grep 'hibernatefile\|hibernatemode' hibernatemode 3 hibernatefile /var/vm/sleepimage ~ % ls /var/vm/ kernelcore sleepimage ~ % sudo pmset hibernatemode 0 Password: ~ % ls /var/vm/ kernelcore ~ %
sudo pmset hibernatemode 0, I had to manually delete the
sudo rm /var/vm/sleepimage
To remove the sleepimage file from macOS Recovery in macOS Catalina 10.15.6, without FileVault, I tested the following without disabling System Integrity Protection.
diskutil listto ascertain which disk was APFS Volume VM. It was:
diskutil mount -mountPoint '/Volumes/VM' disk1s4
diskutil unmount '/Volumes/VM'
Note: This was included just to show doing the SIP Dance is not necessary under macOS Catalina, just remove it from a normal mode boot.