There is no easy way to hibernate a macOS computer on demand. This utility fixes that problem. This command must be run as root, but there's an easy way to fix that:
- Copy
deepsleep.sh
to a folder, such as/usr/bin
(In Terminal, typecp /PATH/TO/deepsleep.sh /usr/bin
) - In Terminal, type:
sudo visudo
to edit the/etc/sudoers
file. DO NOT edit this file with another command. If you do not likevi
you can typeexport VISUAL=nano
first to tellvisudo
to usenano
- Add a line anywhere in the file (I recommend either the very beginning or very end) that says
ALL ALL=NOPASSWD:/LOCATION/TO/deepsleep.sh
(so, for example,ALL ALL=NOPASSWD:/usr/bin/deepsleep.sh
) - Run the command using
sudo /path/to/deepsleep.sh
If you wake the computer before it's finished hibernating, this script will leave it in a bad spot where it will hibernate every time you tell it to go to sleep. To fix this, type sudo pmset -a hibernatemode 3
or `sudo path/to/deeps