How to prevent screen lock when MacBook AC adapter is unplugged?

Solution 1:

Just in case you weren't aware of these options, or haven't already tried this, you could change the Battery settings under Energy Saver.

Your question doesn't specify what version of macOS you're using, but here are some generic steps:

  • Go to System Preferences > Energy Saver
  • Select the Battery tab
  • Set Computer Sleep to Never
  • Set Display Sleep to Never
  • Set Graphics to Higher Performance
  • Make sure Slightly dim the display when using this power source is unchecked
  • Make sure Automatically reduce brightness before display goes to sleep is unchecked
  • Exit System Preferences

Let us know how you go.

Solution 2:

Those still searching, I found this seems to have solved it for me:

sudo pmset disablesleep 1

Source: https://medium.com/macoclock/how-to-prevent-macos-catalina-from-sleeping-when-connected-to-an-external-monitor-e2c876dadaf9

Solution 3:

From https://support.apple.com/en-us/HT201834, you need either "An AC power adapter or an external display that provides power over USB-C or Thunderbolt 3 (USB-C)." This seems to assume that you only have USB-C ports as the new Macs do, but it stands to reason that the older macs are also using the power of the AC adapter to run the displays.

So the only solution is to get monitors that provide the power themselves.