How to Prevent Mac from Sleeping
Step 1. Open Finder. Go to the Applications tab and open System Preferences.
Step 2. Then click on the Energy Saver option.
Step 3. Then select the Power Adapter option.
Step 4. Click on “Prevent computer from sleeping automatically when the display is off” option.
Step 5. Or, you can also drag the slider to control the display’s sleep to Never.