1

My 2018 MacBook Pro is connected to external displays and peripherals via a Thunderbolt 3 dock.

When I step away from my desk I lock the computer by pressing ctrl+cmd+Q on my external keyboard.

This works as expected, kicking the system back to the lock screen.

However, after a few minutes of this state, the system goes to sleep, turning off the screen and requiring time to become interactive again after jabbing the power button.

How can I prevent the laptop from going to sleep once locked if connected to power? The most important aspect of this is that Touch ID stays active, so I can instantly resume work at my desk with a single touch of the sensor.

1
  • Have you looked at caffeine for the mac? You can set it to keep the mac awake for set times... see lightheadsw.com/caffeine
    – Solar Mike
    Commented Jan 25, 2019 at 20:08

2 Answers 2

3

This can be done in Energy Saver:

  1. Open System Preferences
  2. Go to Energy Saver
  3. Select Power Adapter
  4. Check/mark the "Prevent computer from sleeping automatically when the display is off" option
  5. [Optional] Uncheck "Put hard disks to sleep when possible".
1
  • Fast forward to 2023, Ventura 13.15 - no such settings option as Energy Saver anymore. There is Displays, Advanced, Battery & Energy, Prevent automatic sleeping (...), though. Commented Jul 27, 2023 at 13:42
2
sudo caffeinate -s -u

man caffeinate

 -s      Create an assertion to prevent the system from sleeping. This
         assertion is valid only when system is running on AC power.
 -u      Create an assertion to declare that user is active. If the dis-
         play is off, this option turns the display on and prevents the
         display from going into idle sleep. If a timeout is not specified
         with '-t' option, then this assertion is taken with a default of
         5 second timeout.
1
  • I had to specify -d as well. So, it is "sudo caffeinate -s -u -d" and is working. Commented Dec 6, 2022 at 14:59

Not the answer you're looking for? Browse other questions tagged .