To keep your MacBook Pro running processes like Ollama and Ngrok while the screen is locked, you need to ensure that the system doesn't go to sleep, even when the display is off. Here are some steps you can take to achieve this:
-
Adjust Energy Saver Settings:
- Go to System Settings > Battery.
- Under the Battery tab, set "Turn display off after" to a longer duration or "Never" if you prefer.
- Under the Power Adapter tab, ensure "Prevent computer from sleeping automatically when the display is off" is checked.
- Set "Turn display off after" to a longer duration or "Never" if you prefer.
-
Use Terminal to Prevent Sleep:
- You can use the
caffeinatecommand in Terminal to prevent your Mac from sleeping. This command can be tailored to your needs:caffeinate -i - The
-iflag will prevent the system from idle sleeping. You can run this command in a Terminal window, and it will keep your Mac awake until you close the Terminal or stop the command.
- You can use the
-
Third-Party Apps:
- Consider using third-party applications like Amphetamine or KeepingYouAwake. These apps provide a user-friendly interface to keep your Mac awake under specific conditions.
-
Security Settings:
- Ensure that your security settings require a password immediately after the screen saver begins or the display is turned off. Go to System Settings > Security & Privacy > General and set "Require password" to "immediately" after sleep or screen saver begins.
By following these steps, your MacBook should continue running processes even when the screen is locked, while still requiring a password upon resumption.