[macOS] Disable macOS sleep mode by command

[macOS] Disable macOS sleep mode by command

2023-06-20 hit count image

Let's see how to disable the sleep mode by the command.

Outline

The macOS is set to sleep mode by default, so it automatically switches to sleep mode after a certain period of time. However, there are times when you want to prevent the sleep mode, such as when installing something or building something.

In this blog post, I will introduce how to disable sleep mode by command in macOS.

Disable sleep mode

The macOS provides the pmset command to manage power settings. If you run the following command, you can check the current power settings.

pmset -g

Then you can see the following result.

System-wide power settings:
 SleepDisabled		0
Currently in use:
 lidwake              1
 lowpowermode         0
 standbydelayhigh     86400
 standbydelaylow      10800
 standby              1
 proximitywake        1
 ttyskeepawake        1
 hibernatemode        3
 powernap             1
 gpuswitch            2
 hibernatefile        /var/vm/sleepimage
 highstandbythreshold 50
 displaysleep         10
 womp                 1
 networkoversleep     0
 sleep                1
 acwake               0
 halfdim              1
 tcpkeepalive         1
 disksleep            10

You can check the sleep mode by the SleepDisabled item. If it is 0, the sleep mode is enabled, and if it is 1, the sleep mode is disabled.

Next, let’s see how to change the SleepDisabled item to disable the sleep mode using the pmset command. You can disable the sleep mode by running the following command.

sudo pmset -c disablesleep 1

Then, run the following command again to check if the sleep mode is disabled.

pmset -g

Now, you can see that the SleepDisabled item is changed to 1 as follows.

System-wide power settings:
 SleepDisabled		1

The sleep mode affects the battery, so it is recommended to disable the sleep mode only when necessary and enable the sleep mode by running the following command when not needed.

sudo pmset -c disablesleep 0

Completed

Done! We’ve seen how to disable sleep mode using the pmset command in macOS. When you need to change the sleep mode, try using the pmset command to change it.

Was my blog helpful? Please leave a comment at the bottom. it will be a great help to me!

App promotion

You can use the applications that are created by this blog writer Deku.
Deku created the applications with Flutter.

If you have interested, please try to download them for free.

Posts