Skip to content

Instantly share code, notes, and snippets.

@mcnaveen
Created August 18, 2023 05:44
Show Gist options
  • Save mcnaveen/fdaf816aa7c35c77d2df4736f999b8de to your computer and use it in GitHub Desktop.
Save mcnaveen/fdaf816aa7c35c77d2df4736f999b8de to your computer and use it in GitHub Desktop.
Use MacBook in Camshell Mode (Lid Closed) without power adapter connected

Open the terminal and run the below command

pmset -g | grep hibernatemode

Note down the number in safe place, you'll need this later if you want to disable it

Now, run the below commands one by one.

sudo pmset -a sleep 0
sudo pmset -a hibernatemode 0
sudo pmset -a disablesleep 1

If you close the lid of your macbook now, it won't go to sleep mode


Incase you want to disable this behaviour, run the commands one by one

sudo pmset -a sleep 1
sudo pmset -a hibernatemode <original hibernatemode value from the above step or usually 3 on a MacBook>
sudo pmset -a disablesleep 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment