I'm on macOS 10.13.6.

I often need to set a long process running from the terminal, and then lock my Macbook for a while, and I want the process to be still running when the screen is locked. However, the process just hangs as long as the screen is locked. I can confirm that the Macbook is not asleep, and I've checked the box that says "prevent computer from sleeping automatically when the display is off" in "Energy Saver". How do I keep the process running (not hang) when the computer is locked (but not asleep)?

  • Can you elaborate on what process are you talking about? – Nimesh Neema Oct 11 '18 at 9:52
  • Any long-running process. A machine learning training run for example. More concretely, a Python program that takes ages (hours) to run. – Ray Oct 11 '18 at 10:06
  • Do you use a sleep prevention app like Caffeine or KeepingYouAwake? apple.stackexchange.com/questions/89277/… and apple.stackexchange.com/questions/76107/… – Nimesh Neema Oct 11 '18 at 10:16
  • I've heard of them, but as I said, the computer is not asleep. It's merely locked. – Ray Oct 11 '18 at 10:45
  • I inferred that from the question. I was simply suggesting giving it a try and making observation. – Nimesh Neema Oct 11 '18 at 10:47
  1. In System Preferences > Energy Saver, check the box for "Prevent computer from sleeping automatically when the display is off" (on laptops, this is under the Power Adapter tab)
  2. In System Preferences > Security & Privacy, check the box for "Require password after sleep or screen saver begins" and set the delay in the dropdown menu to "immediately"

Now, you can hit command-option-power to turn off the display without sleeping the computer, and doing anything that turns on the display (like hitting a key or clicking a mouse button) will prompt you for your account password.

Credits: This answer

  • Both are already ticked. In fact I've already mentioned in my question precisely what you mentioned in your point 1. This does not answer my question at all. – Ray Oct 12 '18 at 9:11

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.