Prevent your Mac from entering sleep mode. Specify sleep and wake settings.
Check out these Sleep Control Apps:
Amphetamine
With Amphetamine, you can effortlessly override your energy saving settings and keep your Mac awake. You just have to tap on a single icon on your macOS Menu Ba. Once activated, your system will stop going to sleep. You can also set it up so that Amphetamine only kicks on when it notices that a particular app is running.
Lungo
Lungo also prevents your Mac from going to sleep. It has a retina icon and dark mode support. Just click the menu bar icon to quickly activate the app.
Theine
Theine keeps your Mac awake just like caffeine does with you. It prevents your Mac from falling asleep, dimming your screen or starting the screensaver.